import java.util.Random;
import java.util.Scanner;
public class Q8 {
public static void main(String[] args) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
Random r = new Random();
Scanner sc = new Scanner(System.in);
int[] com = new int[3];
for(int i = 0;i<com.length;i++) {
com[i] = r.nextInt(9)+1;
for(int j =0;j<i;j++) {
if(com[i] == com[j]) {
i--;
break;
}
}
}
System.out.println(com[0]+","+com[1]+","+com[2]);
int[] user = new int[3];
while(true) {
for(int i = 0;i<user.length;i++) {
System.out.print((i+1)+"번째 숫자 : ");
user[i] = sc.nextInt();
//범위 1~9아닌경우
if(user[i]<1 || user[i] > 9) {
System.out.println("잘못된"+
"입력입니다.");
i--;
continue;
}
for(int j = 0;j<i;j++) {
if(user[i] == user[j]) {
System.out.println("잘못된"+
입력입니다.");
i--;
break;
}
}
}
int strike = 0;
int ball = 0;
for(int i = 0;i<user.length;i++) {
for(int j = 0;j<com.length;j++) {
if(user[i] == com[j]) {
if(i == j) {
strike++;
}
else {
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);
}
}
}
}