import java.util.Random;
import java.util.Scanner;
public class Q7 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Random r = new Random();
Scanner sc = new Scanner(System.in);
int com1 = r.nextInt(9)+1;
int com2 = r.nextInt(9)+1;
int com3 = r.nextInt(9)+1;
while(com1 == com2 || com2 == com3 || com1 == com3) {
//System.out.println("중복있음");
com1 = r.nextInt(9)+1;
com2 = r.nextInt(9)+1;
com3 = r.nextInt(9)+1;
}
System.out.println(com1+","+com2+","+com3);
while(true) {
System.out.print("첫째자리 : ");
int user1 = sc.nextInt();
System.out.print("둘째자리 : ");
int user2 = sc.nextInt();
System.out.print("셋째자리 : ");
int user3 = sc.nextInt();
if(user1 < 1 || user1 >9 || user2 < 1 || user2 >9
|| user3 <1 || user3 >9) {
System.out.println("잘못된 입력입니다.");
continue;
}
if(user1 == user2 || user2 == user3 ||
user1 == user3) {
System.out.println("잘못된 입력입니다.");
continue;
}
int strike = 0;
int ball = 0;
if(user1 == com1) {
strike++;
}
if(user2 == com2) {
strike++;
}
if(user3 == com3) {
strike++;
}
if(user1 == com2 || user1 == com3) {
ball++;
}
if(user2 == com1 || user2 == com3) {
ball++;
}
if(user3 == com1 || user3 == com2) {
ball++;
}
if(strike == 0 && ball == 0) {
System.out.println("Out입니다.");
}
else if(strike == 3) {
System.out.println("홈런입니다.");
break;
}
else {
System.out.println("strike : "+strike+
", ball : "+ball);
}
}
}
}