code: public static Map<Character, Long> charsCount(String input) {
          if (isNullOrEmpty(input)) {
              return Collections.emptyMap();
          }
  
          return input.chars().mapToObj(c -> (char) c).collect(groupingBy(identity(), counting()));
      }
docs: Counts the number of occurrences of each character in the string
  
  @param input The input string
  @return A map containing the number of occurrences of each character in the string