/* * ParenArray.java */ import java.util.Scanner; //Scanner is a class for reading from devices, it breaks its input into tokens using a delimiter patter, by default the delimiter is whitespace import java.util.Stack; public class ParenArray { public static void main (String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Please input a sequence (Press Enter when you're done):"); String str = sc.nextLine(); // the method nextLine() is to advance this scanner past the current line and to return the input that was skipped Stack S=new Stack(); //define a stack of characters to hold the brackets for(int i=0; i