技巧一://统计字符串s1的频率

    String s1 = in.nextLine();
//统计字符串s1的频率
        for (char c1 : s1.toCharArray()) {
            if (hashMap1.containsKey(c1)) {
                hashMap1.put(c1, hashMap1.get(c1) + 1);
            } else {
                hashMap1.put(c1, 1);
            }
        }
View Code

相关文章:

  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2021-05-23
  • 2021-08-17
  • 2021-10-28
  • 2022-02-09
猜你喜欢
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案