<gouthampradhan>stack_DecodeString_1.java
public String decodeString(String s) {
    Stack<Character> stack = new Stack<>();
    for (int i = 0; i < s.length(); i++) {
      if (s.charAt(i) == ']') {
        StringBuilder stackBuff = new StringBuilder();
        while (stack.peek() != '[') {
          stackBuff.append(stack.pop());
        }
        stack.pop(); 
        String num = "";
        while (!stack.isEmpty() && !Character.isAlphabetic(stack.peek()) && stack.peek() != '[') {
          num = stack.pop() + num;
        }
        String str = stackBuff.reverse().toString();
        StringBuilder stringMultiple = new StringBuilder();
        int N = Integer.parseInt(num);
        while (N-- > 0) {
          stringMultiple.append(str);
        }
        for (int j = 0; j < stringMultiple.length(); j++) {
          stack.push(stringMultiple.charAt(j));
        }
      } else stack.push(s.charAt(i));
    }
    StringBuilder result = new StringBuilder();
    while (!stack.isEmpty()) {
      result.append(stack.pop());
    }
    return result.reverse().toString();
  }
public String var_0 ( String var_2 ) {
  Stack < Character > var_5 = new Stack < > ( ) ;
  for ( int var_7 = 0 ;
  var_7 < var_2 . length ( ) ;
  var_7 ++ ) {
    if ( var_2 . charAt ( var_7 ) == ']' ) {
      StringBuilder var_12 = new StringBuilder ( ) ;
      while ( var_5 . peek ( ) != '[' ) {
        var_12 . append ( var_5 . pop ( ) ) ;
      }
      var_5 . pop ( ) ;
      String var_18 = "" ;
      while ( ! var_5 . isEmpty ( ) && ! Character . isAlphabetic ( var_5 . peek ( ) ) && var_5 . peek ( ) != '[' ) {
        var_18 = var_5 . pop ( ) + var_18 ;
      }
      String var_23 = var_12 . reverse ( ) . toString ( ) ;
      StringBuilder var_24 = new StringBuilder ( ) ;
      int var_27 = Integer . parseInt ( var_18 ) ;
      while ( var_27 -- > 0 ) {
        var_24 . append ( var_23 ) ;
      }
      for ( int var_28 = 0 ;
      var_28 < var_24 . length ( ) ;
      var_28 ++ ) {
        var_5 . push ( var_24 . charAt ( var_28 ) ) ;
      }
    }
    else var_5 . push ( var_2 . charAt ( var_7 ) ) ;
  }
  StringBuilder var_30 = new StringBuilder ( ) ;
  while ( ! var_5 . isEmpty ( ) ) {
    var_30 . append ( var_5 . pop ( ) ) ;
  }
  return var_30 . reverse ( ) . toString ( ) ;
}
