/*Tomas George Bogdan *problema 3 - Inchiderea corecta a Parantezelor */ import Stive.*; import java.io.*; import java.util.*; public class Paranteze { public static void main(String[] argv) { for(int i = 0; i < argv.length; i++) { StivaInlantuita stiva = new StivaInlantuita(); boolean corect = true; for(int j = 0; j < argv[i].length(); j++) { if( argv[i].charAt(j) == '(') stiva.push(new Integer(1)); if( argv[i].charAt(j) == ')') { if( !stiva.esteVida()) stiva.pop(); else corect = false; } } if(!stiva.esteVida()) corect = false; System.out.println(argv[i] + " - " + (corect == true ? "corect" : "incorect")); } } }