public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<Integer>();
ArrayList<Integer> list2 = new ArrayList<Integer>();
for (int i = 0; i < 10; i++){
list.add(Integer.parseInt(reader.readLine()));
}
for (int i = 0; i < list.size(); i++){
int count = 0;
for (int j = i; j < list.size(); j++) {
while (true) {
if (list.get(i) == list.get(j)) {
count++;
}
else break;
}
list2.add(count);
}
}
Collections.sort(list2);
System.out.println(list2.get(list2.size() - 1));
}
}Роберт
14 уровень
Подскажите, что я делаю не так.
Обсуждается
Комментарии (1)
- популярные
- новые
- старые
Для того, чтобы оставить комментарий Вы должны авторизоваться
Java Student
9 февраля 2020, 13:03
Этот код бесконечно повторяется
0