What is wrong with my code... It works :\
EDIT: Resolved on my own. Apparently we're living in an alternate universe where indices aren't 0 based.
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int num1 = Integer.parseInt(reader.readLine());
int num2 = Integer.parseInt(reader.readLine());
int num3 = Integer.parseInt(reader.readLine());
int arr[] = new int[3];
arr[0] = num1;
arr[1] = num2;
arr[2] = num3;
if(arr[0] == arr[1] && arr[0] != arr[2]){
System.out.print(2);
}else if(arr[0] == arr[2] && arr[0] != arr[1]){
System.out.print(1);
}else if(arr[1] == arr[2] && arr[0] != arr[2]){
System.out.print(0);
}
}
}
package com.codegym.task.task04.task0424;
/*
Three numbers
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int num1 = Integer.parseInt(reader.readLine());
int num2 = Integer.parseInt(reader.readLine());
int num3 = Integer.parseInt(reader.readLine());
int arr[] = new int[3];
arr[0] = num1;
arr[1] = num2;
arr[2] = num3;
if(arr[0] == arr[1] && arr[0] != arr[2]){
System.out.print(2);
}else if(arr[0] == arr[2] && arr[0] != arr[1]){
System.out.print(1);
}else if(arr[1] == arr[2] && arr[0] != arr[2]){
System.out.print(0);
}
}
}