s=gets ac=0 fr='' last=false ls = [] for i in 0...s.size if s[i] == 'w' ac += 1 last = true else if last and fr!='' ls << [ac, fr] ac=0 fr='' end last=false fr += s[i] end end n = ls.map{|a|a[0]}.max for x,f in ls puts f if n == x end