static void Main() { var records = new List <long>(); while (true) { try { using (var sc = new SetConsole()) { var sw = new Stopwatch(); sw.Start(); Program.Main(null); sw.Stop(); records.Add(sw.ElapsedMilliseconds); sw.Reset(); } } catch (Exception ex) { Console.WriteLine(ex); Console.WriteLine("\n===================="); Console.WriteLine("Process was supended"); Console.WriteLine("====================\n"); } if (records.Any()) { Console.WriteLine("\n===================="); Console.WriteLine($"Time is {records.Last()}ms"); Console.WriteLine($"AveTime is {records.Average()}ms"); Console.WriteLine("====================\n"); } } }
public static void Main(string[] args) { using (var sc = new SetConsole()) { var array = new string[] { "dream", "dreamer", "erase", "eraser" }; var str = GetString(); while (str.Length != 0) { int strLength = str.Length; foreach (var item in array) { if (str.EndsWith(item)) { str = str.Remove(str.Length - item.Length); break; } } if (strLength == str.Length) { CWrite("NO"); return; } } CWrite("YES"); } }