comefrom: <awangdev>71. Simplify Path_1.java
code: public String simplifyPath(String path) {
          Stack<String> stack = new Stack<>();
          String[] parts = path.split("/");
          for (String s : parts) {
              if (s.isEmpty() || s.equals(".")) continue;
              if (s.equals("..")) {
                  if (!stack.isEmpty()) stack.pop();
                  continue;
              }
              stack.push(s);
          }
          
          StringBuffer sb = new StringBuffer();
          while (!stack.isEmpty()) sb.insert(0, "/" + stack.pop());
          if (sb.length() == 0) sb.append("/");
  
          return sb.toString();
      }
masked: public String var_0 ( String var_2 ) {
    Stack < String > var_4 = new Stack < > ( ) ;
    String [ ] var_7 = var_2 . split ( "/" ) ;
    for ( String var_8 : var_7 ) {
      if ( var_8 . isEmpty ( ) || var_8 . equals ( "." ) ) continue ;
      if ( var_8 . equals ( ".." ) ) {
        if ( ! var_4 . isEmpty ( ) ) var_4 . pop ( ) ;
        continue ;
      }
      var_4 . push ( var_8 ) ;
    }
    StringBuffer var_16 = new StringBuffer ( ) ;
    while ( ! var_4 . isEmpty ( ) ) var_16 . insert ( 0 , "/" + var_4 . pop ( ) ) ;
    if ( var_16 . length ( ) == 0 ) var_16 . append ( "/" ) ;
    return var_16 . toString ( ) ;
  }
  