using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace No342_1{ public class Program{ public static void Main(string[] args){ const char constChar = 'w'; var charList = Console.ReadLine().SkipWhile(c => c == constChar).ToList(); var strList = new List(); var sb = new StringBuilder(); sb.Append(charList[0]); for(var i = 1; i < charList.Count; i++){ if(charList[i - 1] == constChar && charList[i] != constChar){ strList.Add(sb.ToString()); sb.Clear(); } sb.Append(charList[i]); } strList.Add(sb.ToString()); Func charCount = s => s.Count(c => c == constChar); strList.Where(s => charCount(s) == strList.Max(charCount)).ToList() .ForEach(s => { s.TakeWhile(c => c != constChar).ToList().ForEach(Console.Write); Console.WriteLine(); }); } } }