public String simplifyPath(String path) {
        String[] metaPath = path.trim().split("/+");
        Deque<String> stk = new ArrayDeque<String>();
        for(String meta : metaPath){
            if(meta.isEmpty()) continue;
            if(meta.equals("..")){
                if(!stk.isEmpty()) stk.removeLast();
            }else if(!meta.equals(".")){
                stk.offerLast(meta);
            }
        }
        StringBuilder sb = new StringBuilder("/");
        for(String meta : stk){
            sb.append(meta).append("/");
        }
        return sb.length() == 1 ? sb.toString() : sb.deleteCharAt(sb.length() - 1).toString();
    }