-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathI033.java
More file actions
51 lines (46 loc) · 1.83 KB
/
I033.java
File metadata and controls
51 lines (46 loc) · 1.83 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package levelB;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class I033 {
public static void main(String[] args) throws Exception{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
boolean flag=true;
String first=br.readLine();
if(first.contains(",")||first.contains(".")||first.contains("-")||first.contains("+"))
flag=false;
char[] badkey=first.toCharArray();
char[] word=br.readLine().toCharArray();
if(flag) {
for(int i=0;i<badkey.length;i++) {
for(int j=0;j<word.length;j++) {
if(word[j]==badkey[i]&&(word[j]>=48||word[j]<=57)) {
word[j]='%';
}else if((word[j]==badkey[i]||word[j]==badkey[j]+32)&&((word[j]>=65&&word[j]<=90)||(word[j]>=97&&word[j]<=122))){
word[j]='%';
}else if(word[j]=='_'&&word[j]==badkey[i]){
word[j]='%';
}
}
}
}else {
for(int i=0;i<badkey.length;i++) {
for(int j=0;j<word.length;j++) {
if((word[j]>=48||word[j]<=57)&&word[j]==badkey[i]) {
word[j]='%';
}else if((word[j]>=97&&word[j]<=122)&&(word[j]==badkey[i]+32)) {
word[j]='%';
}else if(word[j]=='_'&&word[j]==badkey[i]){
word[j]='%';
}else if(word[j]>=65&&word[j]<=90) {
word[j]='%';
}
}
}
}
for(int i=0;i<word.length;i++) {
if(word[i]!='%') {
System.out.print(word[i]);
}
}
}
}