-
Notifications
You must be signed in to change notification settings - Fork 0
/
HJ23.java
32 lines (26 loc) · 984 Bytes
/
HJ23.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.io.*;
import java.util.*;
public class HJ23 {
public static void main(String[] args) throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//好复杂啊,怎么记
String aa = reader.readLine();
char[] c = aa.toCharArray();
int[] temp = new int[26];
for(int i = 0; i < c.length; i++)
{temp[c[i]-'a']++;}
int min = 50;
for(int i = 0; i < 26; i++)
{
if(temp[i] != 0)
min = Math.min(min,temp[i]);
}
for(int i = 0; i < 26; i++)
{
char ch = (char)(i + 'a');
if(temp[i] == min)
aa = aa.replace(ch + "",""); //替换不会,是特殊用法吗?
}
System.out.println(aa);
}
}//字符串的键入和字符串的处理比较复杂需记忆