zhinushannan / volume Goto Github PK
View Code? Open in Web Editor NEW读书破万卷(第三声)
读书破万卷(第三声)
package 二零javab;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
/**
* Created with IntelliJ IDEA.
*
* @Author: ice_water
* @Date: 2022/03/18/10:10 PM
* @Description: 要做耿沁园的男人
*/
public class G_02 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String str = scanner.nextLine();
Map<Character, Integer> map = new HashMap<>();
// 初始化结果,便于后期比较
char res = str.charAt(0);
for (int i = 0; i < str.length(); i++) {
Character a = str.charAt(i);
// 若存在 则+1
if (map.containsKey(a)) {
map.put(a, map.get(a) + 1);
// 若不存在 则放入map中
} else {
map.put(a, 1);
}
// 如果有多个字母出现的次数相等,结果为字典序最小的那个。
if (map.get(res) == map.get(a)) {
if (res > a) {
res = a;
}
} else {
if (map.get(res) < map.get(a)) {
res = a;
}
}
}
System.out.println(res);
System.out.println(map.get(res));
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.