using System;
using System.Collections;
public class Program
{
public static void Main()
// Create a new stack
Stack myStack = new Stack();
// Add items to the stack
myStack.Push(2);
myStack.Push(4);
myStack.Pop();
myStack.Push(1);
myStack.Push(11);
myStack.Push(22);
myStack.Push(45);
myStack.Push(99);
// Output the contents of the stack
foreach (var item in myStack)
Console.WriteLine(item);
}
// Count the items in the stack
Console.WriteLine("Number of elements in Stack: {0}", myStack.Count);