code: private static int minLen(String... patterns) {
      int minLen = patterns[0].length();
      for (String str : patterns) {
        if (str.length() < minLen) {
          minLen = str.length();
        }
      }
      return minLen;
    }
docs: Find the shortest of all patterns.
  @param patterns
  @return