Dear CodeGym Members,
Good Evening/Bonsoir.
I need your valuable help in this task. I am getting the right result but my task is getting failed.
Thank you all for your help and support in advance.
Bonne Journee.
Regards,
Sanjay Chauhan
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
//write your code here
ArrayList list = new ArrayList();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
for(int i=0;i<10;i++)
list.add(Integer.parseInt(reader.readLine()));
int longest_count=0,temp_count=0;
for(int i=0;i<=list.size()-1;i++) {
temp_count=0;
for (int j = 0; j <= list.size()-1; j++) {
if(list.get(i).equals(list.get(j))){
temp_count+=1;
}
}
if(longest_count<temp_count)
longest_count=temp_count;
}
System.out.println(longest_count);
}
}