//  Data Structures with Java by John R. Hubbard
//  Copyright McGraw-Hill, 2001
//  Problem 6.13 on page 120
//  Testing another reverse(Stack) method

import java.util.Stack;

public class Pr0613
{ public static void main(String[] args)
  { Stack kids = new Stack();
    kids.push("Sara");
    kids.push("John");
    kids.push("Andy");
    kids.push("Mike");
    System.out.println(kids);
    reverse(kids);
    System.out.println(kids);
  }
  
  private static void reverse(Stack stack)
  { Stack copiedStack = (Stack)stack.clone();
    stack.clear();
    while(!copiedStack.empty())
      stack.push(copiedStack.pop());
  }
}
  