Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. class Imp1_zso7_taak1 {
  2.   public static void main(String[] args){
  3.     String invoer;
  4.     int haakjesTeller = 0;
  5.     invoer = args[0];
  6.     if(args.length < 1) return;
  7.     for(int i=0;i < invoer.length(); i++) {
  8.       if(invoer.charAt(i) == '(') haakjesTeller++;
  9.       if(invoer.charAt(i) == ')') haakjesTeller--;
  10.       if(haakjesTeller < 0){ System.out.println("niet ok"); return;}
  11.          }
  12.       if(haakjesTeller == 0) System.out.println("ok");
  13.       else System.out.println("niet ok");
  14.   }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement