s = gets.chop maxcount = 0 wstart = 0 wend = 0 tmp = 0 i = 0 while i < s.size if s[i] == "w" tmp += 1 if maxcount < tmp maxcount = tmp wend = i end else wstart = i if i - 1 >= 0 && s[i - 1] == "w" wstart = i if i == 0 tmp = 0 end i += 1 end puts s[wstart..wend]