public class Solution {
private static List<String> strings;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
strings = new ArrayList<String>();
for(int i = 0;i < 5;i++) {
strings.add(br.readLine());
}
int longest = strings.get(0).length();
for(int j = 1;j < strings.size();j++) {
int temp = strings.get(j).length();
if(longest < temp)
longest = temp;
}
for(int k = 0;k < strings.size();k++) {
if(longest == strings.get(k).length());
System.out.println(strings.get(k));
}
}
}
Everything is correct,but it showing wrong output
Archived
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
Gellert Varga
14 June 2020, 21:08
The error is caused by a single semicolon. You need to remove it.
Practice interpreting the program and you will find that semicolon.
+1
Faisal Ahmed
15 June 2020, 04:45
where i missed the semicolon,can you tell me that line pls...
0
zimme
15 June 2020, 06:23
last if
+1
Faisal Ahmed
15 June 2020, 06:58
got it thanku
0