using System;
using System.Collections.Generic;
class Example
{
public static void Main()
{
Stack numbers = new Stack();
numbers.Push("one");
numbers.Push("two");
numbers.Push("three");
numbers.Push("four");
numbers.Push("five");
foreach( string number in numbers )
{
Console.WriteLine(number);
}
Console.WriteLine(numbers.Pop());
Console.WriteLine(numbers.Peek());
Console.WriteLine( numbers.Pop());
Stack stack2 = new Stack(numbers.ToArray());
foreach( string number in stack2 )
{
Console.WriteLine(number);
}
string[] array2 = new string[numbers.Count * 2];
numbers.CopyTo(array2, numbers.Count);
Stack stack3 = new Stack(array2);
Console.WriteLine("\nContents of the second copy, with duplicates and nulls:");
foreach( string number in stack3 )
{
Console.WriteLine(number);
}
Console.WriteLine(stack2.Contains("four"));
stack2.Clear();
Console.WriteLine(stack2.Count);
}
}