using System; using System.Collections.Generic; using System.Linq; class Warota : IComparable { public string Word; public int Len; public Warota(string word, int len) { Word = word; Len = len; } public int CompareTo(Warota w) { return Len.CompareTo(w.Len); } } class Program { static void Main() { string s = Console.ReadLine(); var w = new List(); string buf = ""; int wcnt = 0; s = new string(s.Reverse().ToArray()) + "w"; foreach (var c in s) { if (c != 'w') { buf = buf.Insert(0, c.ToString()); } else { if (buf != "") { w.Add(new Warota(buf, wcnt)); wcnt = 0; } buf = ""; wcnt++; } } w.Reverse(); foreach (var ans in w) { if (ans.Len == w.Max().Len) { Console.WriteLine(ans.Word); } } } }