code: private static int getCanonicalIndex(String s, boolean strict) {
          int len = s.length();
          if (len == 0) {
              return -1;
          }
          int ch = s.charAt(0);
          //      verify that all are the same character
          for (int i = 1; i < len; ++i) {
              if (s.charAt(i) != ch) {
                  return -1;
              }
          }
          int bestRow = -1;
          for (int i = 0; i < types.length; ++i) {
              int[] row = types[i];
              if (row[0] != ch) continue;
              bestRow = i;
              if (row[3] > len) continue;
              if (row[row.length-1] < len) continue;
              return i;
          }
          return strict ? -1 : bestRow;
      }
docs: Get the canonical index, or return -1 if illegal.
  @param s
  @param strict TODO