-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindingTheWords.java
More file actions
44 lines (41 loc) · 1006 Bytes
/
FindingTheWords.java
File metadata and controls
44 lines (41 loc) · 1006 Bytes
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
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String input1 = sc.next().toLowerCase();
String input2[] = sc.next().toLowerCase().split(":");
String res="";
for(int i=0;i<input2.length;i++){
int flag=0;
for(int j=0;j<input1.length();j++){
if(input1.charAt(j)=='_'){
continue;
}
else if(input2[i].charAt(j)!=input1.charAt(j)){
//System.out.println(input2[i].charAt(j)!=input1.charAt(j));
flag=1;
break;
}
else{
System.out.println("true");
}
}
if(flag==0){
res+=input2[i].toUpperCase()+":";
}
}
if(res.length()==0){
System.out.println("ERROR-009");
}
else{
System.out.println(res.substring(0,res.length()-1));
}
}
}
/*
Example:
input: Fi_er
Fibre:Filer:fiber:fixer:fimer:filter
output: FILER:FIBER:FIXER:FIMER
*/