Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.Arrays;
- class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int[] numbers = Arrays
- .stream(scanner.nextLine().split(" "))
- .mapToInt(Integer::parseInt)
- .toArray();
- int number = 0, count, maxCount = 0;
- for (int i = 0; i < numbers.length; i++) {
- count = 0;
- for (int j = i; j < numbers.length; j++) {
- if (numbers[i] == numbers[j]){
- count++;
- }
- }
- if (count > maxCount) {
- maxCount = count;
- number = numbers[i];
- }
- }
- System.out.println(number);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement