package com.codegym.task.task04.task0424;
/*
Three numbers
*/
import java.io.*;
import java.util.*;
public class Solution {
public static int findIndex(int arr[], int t)
{
// if array is Null
if (arr == null) {
return -1;
}
// find length of array
int len = arr.length;
int i = 0;
// traverse in the array
while (i < len) {
// if the i-th element is t
// then return the index
if (arr[i] == t) {
return i;
}
else {
i++;
}
}
return -1;
}
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int[] nums= {a,b,c};
if(a==b){
System.out.println(findIndex(nums,c));
}
else if(b==c){
System.out.println(findIndex(nums,a));
}
else if(c==a){
System.out.println(findIndex(nums,b));
}
}
}
package com.codegym.task.task04.task0424;
/*
Three numbers
*/
import java.io.*;
import java.util.*;
public class Solution {
public static int findIndex(int arr[], int t)
{
// if array is Null
if (arr == null) {
return -1;
}
// find length of array
int len = arr.length;
int i = 0;
// traverse in the array
while (i < len) {
// if the i-th element is t
// then return the index
if (arr[i] == t) {
return i;
}
else {
i++;
}
}
return -1;
}
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int[] nums= {a,b,c};
if(a==b){
System.out.println(findIndex(nums,c));
}
else if(b==c){
System.out.println(findIndex(nums,a));
}
else if(c==a){
System.out.println(findIndex(nums,b));
}
}
}