<gouthampradhan>string_SimplifyPath_1.java
public String simplifyPath(String path) {
    if (path == null || path.isEmpty()) return "/";
    StringTokenizer st = new StringTokenizer(path, "/");
    Deque<String> dQueue = new ArrayDeque<>();
    while (st.hasMoreTokens()) {
      String token = st.nextToken();
      if (token.trim().equals("..")) {
        if (!dQueue.isEmpty()) dQueue.pop();
      } else if (token.trim().equals(".")) {
      } else dQueue.push(token);
    }
    if (dQueue.isEmpty()) return "/";
    StringBuilder finalStr = new StringBuilder();
    while (!dQueue.isEmpty()) {
      finalStr.append("/").append(dQueue.removeLast());
    }
    return finalStr.toString();
  }
public String var_0 ( String var_2 ) {
  if ( var_2 == null || var_2 . isEmpty ( ) ) return "/" ;
  StringTokenizer var_7 = new StringTokenizer ( var_2 , "/" ) ;
  Deque < String > var_10 = new ArrayDeque < > ( ) ;
  while ( var_7 . hasMoreTokens ( ) ) {
    String var_13 = var_7 . nextToken ( ) ;
    if ( var_13 . trim ( ) . equals ( ".." ) ) {
      if ( ! var_10 . isEmpty ( ) ) var_10 . pop ( ) ;
    }
    else if ( var_13 . trim ( ) . equals ( "." ) ) {
    }
    else var_10 . push ( var_13 ) ;
  }
  if ( var_10 . isEmpty ( ) ) return "/" ;
  StringBuilder var_21 = new StringBuilder ( ) ;
  while ( ! var_10 . isEmpty ( ) ) {
    var_21 . append ( "/" ) . append ( var_10 . removeLast ( ) ) ;
  }
  return var_21 . toString ( ) ;
}
