Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. { ArrayStack<Character> stack = new ArrayStack<Character>(100);
  2. int prev=0;
  3. int tek=0;
  4. int pom=0;
  5. for (int i=0;i<St.length;i++) {
  6. if (St[i]=='S' || St[i]=='T')
  7. stack.push(St[i]);
  8.  
  9. }
  10. while (stack.pop()!='S') {
  11. pom++;}
  12.  
  13.  
  14. while (!stack.isEmpty()) {
  15.  
  16. if (stack.pop()=='T')
  17. tek++;
  18.  
  19. else {
  20. if( pom == tek)
  21. tek=0;
  22. else return 0;
  23.  
  24. }
  25.  
  26. }
  27. return 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement