fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. List<int> list = new List<int>();
  13. for (; ; )
  14. {
  15. char sign = char.Parse(Console.ReadLine());
  16.  
  17. switch (sign)
  18. {
  19. case '+':
  20. {
  21. if (list.Count >= 10) Console.WriteLine(":(");
  22. else
  23. {
  24. int number = int.Parse(Console.ReadLine());
  25. list.Add(number);
  26. }
  27. break;
  28. }
  29. case '-':
  30. {
  31. if (list.Count == 0) Console.WriteLine(":(");
  32. else
  33. {
  34. Console.WriteLine(list[list.Count - 1]);
  35. list.Remove(list[list.Count - 1]);
  36. }
  37. break;
  38. }
  39.  
  40. }
  41.  
  42. }
  43.  
  44.  
  45. }
  46. }
  47.  
Runtime error #stdin #stdout #stderr 0.06s 27328KB
stdin
+
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
0
+
1
-
-
-
-
-
-
-
-
-
-
-
stdout
:(
0
9
8
7
6
5
4
3
2
1
:(
stderr
Unhandled Exception:
System.ArgumentNullException: Argument cannot be null.
Parameter name: s
  at System.Char.Parse (System.String s) [0x00000] in <filename unknown>:0 
  at Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Argument cannot be null.
Parameter name: s
  at System.Char.Parse (System.String s) [0x00000] in <filename unknown>:0 
  at Program.Main (System.String[] args) [0x00000] in <filename unknown>:0