# coding: utf-8 s=gets.chomp s = s.sub(/\Aw+/, "") s = s.sub(/[^w]+\Z/, "") if s.count("w") == s.size then puts "" elsif s.include?("w") == false then puts "" else i = 0 j = 0 mx = 0 ss = [] while i < s.size do while j < s.size && s[j] != "w" do j += 1 end a = s[i, j-i] i = j while j < s.size && s[j] == "w" do j += 1 end n = j - i if mx < n then mx = n ss = [a] elsif mx == n then ss << a end i = j end ss.each do |s| puts s end end