code: public static String mergeSlashesInUrl(String url) {
          StringBuilder builder = new StringBuilder();
          boolean prevIsColon = false;
          boolean inMerge = false;
          for (int i = 0; i < url.length(); i++) {
              char c = url.charAt(i);
              if (c == ':') {
                  prevIsColon = true;
                  builder.append(c);
              } else {
                  if (c == '/') {
                      if (prevIsColon) {
                          builder.append(c);
                          inMerge = false;
                      } else {
                          if (!inMerge) {
                              builder.append(c);
                          }
                          inMerge = true;
                      }
                  } else {
                      inMerge = false;
                      builder.append(c);
                  }
  
                  prevIsColon = false;
              }
          }
  
          return builder.toString();
      }
docs: Merges all occurrences of multiple slashes into a single slash (e.g. "a///b//c/d" becomes "a/b/c/d")
  @param url The string to process
  @return The resulting string with merged slashes.