Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Test3 {
- public static void main(String[] args) {
- Scanner reader = new Scanner(System.in);
- int input = Integer.parseInt(reader.nextLine());
- int longer =1;
- int longest =1;
- String[] myArr = new String[input];
- myArr[0] = reader.nextLine();
- for (int i = 1; i <input ; i++) {
- myArr[i] = reader.nextLine();
- if(myArr[i].equals(myArr[i-1])){
- longer++;
- if(longer>longest){
- longest=longer;
- }
- }else{
- longer=1;
- }
- }
- System.out.println(longest);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment