Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- class Program
- {
- static void Main()
- {
- string value = Console.ReadLine();
- Stack<int> stack = new Stack<int>();
- for (int i = 0; i <= value.Length - 1; i++)
- {
- char n = value[i];
- if (n>='0'&&n<='9')
- {
- int val = (int)Char.GetNumericValue(n);
- stack.Push(val);
- }
- }
- while (stack.Count > 0)
- {
- Console.Write("{0} ", stack.Pop());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement