// For testing. Don't modify. public static void Main(string[] args) { string test = Console.ReadLine(); if (test == "rpn") { var rpn = new RPN(); while (true) { string userInput = Console.ReadLine(); if (userInput == "end") { break; } else { rpn.Process(userInput); Console.WriteLine("=" + rpn.Result()); } } } if (test == "remove_max") { var s1 = new Stack <int>(); Console.ReadLine() .Split(new[] { ',' }) .Select(Int32.Parse).ToList() .ForEach(n => s1.Push(n)); Console.WriteLine(RemoveMax(ref s1)); Console.WriteLine( string.Join(",", s1.Reverse().Select(i => i.ToString()).ToArray())); } }