using System; using System.Collections.Generic; namespace No342 { class Program { enum LoopMode { search, count_w, count_text } static void Main(string[] args) { LoopMode mode = LoopMode.search; int count_w = 0; string count_text = ""; int max_text = 0; List result_text = new List(); string text = "w" + Console.ReadLine(); for (int i = text.Length - 1; i >= 0; i--) { switch(mode) { case LoopMode.search: if (text[i] == 'w') { mode = LoopMode.count_w; count_w = 1; } break; case LoopMode.count_w: if (text[i] == 'w') count_w++; else { mode = LoopMode.count_text; count_text = text[i].ToString(); } break; case LoopMode.count_text: if (text[i] == 'w') { if (max_text < count_w) { result_text.Clear(); result_text.Add(count_text); max_text = count_w; } else if (max_text == count_w) { result_text.Add(count_text); max_text = count_w; } mode = LoopMode.count_w; count_w = 1; } else count_text = text[i].ToString() + count_text; break; } } for (int i = result_text.Count - 1; i >= 0; i--) Console.WriteLine(result_text[i]); } } }