public static int commonPrefixLength(CharSequence s1, CharSequence s2) {
    int maxCommonLength = Math.min(s1.length(), s2.length());
    for (int i = 0; i < maxCommonLength; ++i) {
      if (s1.charAt(i) != s2.charAt(i)) {
        return i;
      }
    }
    return maxCommonLength;
  }
public static int commonPrefixLength(CharSequence s1, CharSequence s2)