a=gets.chars.chunk{|c|c=='w'}.drop_while{|k,v|k==true}.each_slice(2).map{|(a,b),(c,d)|[-(d||[]).size,b*'']}.sort puts a.take_while{|x,y|x==[a[0][0],-1].min}.map(&:last)