fork(1) 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. string x;
  14. while (((x = Console.ReadLine())) != null)
  15. {
  16. char sign = char.Parse(x);
  17.  
  18. switch (sign)
  19. {
  20. case '+':
  21. {
  22. if (list.Count >= 10) Console.WriteLine(":(");
  23. else
  24. {
  25. int number = int.Parse(Console.ReadLine());
  26. list.Add(number);
  27. Console.WriteLine(":)");
  28. }
  29. break;
  30. }
  31. case '-':
  32. {
  33. if (list.Count == 0) Console.WriteLine(":(");
  34. else
  35. {
  36. Console.WriteLine(list[list.Count - 1]);
  37. list.Remove(list[list.Count - 1]);
  38. }
  39. break;
  40. }
  41.  
  42. }
  43.  
  44. }
  45.  
  46.  
  47. }
  48. }
  49.  
  50.  
  51.  
  52.  
Success #stdin #stdout 0.04s 24304KB
stdin
+
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
0
+
1
-
-
-
-
-
-
-
-
-
-
-
stdout
:)
:)
:)
:)
:)
:)
:)
:)
:)
:)
:(
0
9
8
7
6
5
4
3
2
1
:(