title: java String manipulation, change multiple slashes to one slash
body: <p><strong>Silly mistake ＋ is used instead of ＋</strong> </p>
  
  <p>all, I am trying to convert all the "/+ "in input path to "/" to simplify unix - style path.</p>
  
  <pre><code> path.replaceAll( "/+", "/"); 
   path.replaceAll( "\\/+", "/"); 
  </code></pre>
  
  <p>turns out not doing anything, what is the right way of doing this?</p>
  
  <pre><code>public class SimplifyPath {
  public String simplifyPath(String path) {
      Stack&lt;String&gt; direc = new Stack&lt;String&gt; ();
      path = path.replaceAll("/＋", "/");
      System.out.println("now path becomes " + path);  // here path remains "///"
  
      int i = 0;
      while (i &lt; path.length() - 1) {
          int slash = path.indexOf("/", i + 1);
          if (slash == -1) break;
          String tmp = path.substring(i, slash);
          if (tmp.equals("/.")){
              continue;
          } else if (tmp.equals("/..")) {
              if (! direc.empty()){
                  direc.pop();
              }
              return "/";
          } else {
              direc.push(tmp);
          }
          i = slash;
      }
      if (direc.empty()) return "/";
      String ans = "";
      while (!direc.empty()) {
          ans = direc.pop() + ans;
      }
      return ans;
  }
  
  public static void main(String[] args){
      String input = "///";
      SimplifyPath test = new SimplifyPath();
      test.simplifyPath(input);
   }
  }
  </code></pre>