-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathko.java
More file actions
36 lines (27 loc) · 736 Bytes
/
ko.java
File metadata and controls
36 lines (27 loc) · 736 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
import java.util.ArrayList;
class ko{
public static void main(String[] args) {
ArrayList<String> a=new ArrayList<>();
a.add("flower");
a.add("flow");
a.add("flight");
int min=a.get(0).length();
for(int i=0;i<a.size();i++ ){
min=Math.min(min, a.get(i).length());
}
boolean mis=false;
for(int i=0;i<min;i++){
char c=a.get(0).charAt(i);
for(int j=1;j<a.size();j++){
if(a.get(j).charAt(i)!=c){
mis=true;
break;
}
}
if (mis) {
break;
}
System.out.println(c);
}
}
}