public class Solution {
public static void main(String[] args) throws IOException {
ArrayList<String> strings = new ArrayList<>();
Scanner scanner = new Scanner(System.in);
for (int i = 0; i<10; i++){
strings.add(scanner.nextLine());
}
String x = strings.get(0);
for (String s : strings){
if (s.length()>=x.length()){
x = s;
} else {
System.out.println(s);
break;
}
}
}
}
Last requirement won't pass
TheVirus
Poziom 22
What is worng with my code?
Rozwiązane
Komentarze (2)
- Popularne
- Najnowsze
- Najstarsze
Musisz się zalogować, aby dodać komentarz
Leszek
23 lipca 2023, 12:44rozwiązanie
you print first element who not achieves requirements and you must print only index
+2
TheVirus
23 lipca 2023, 13:04
Thanks!
0