Language: Java



import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;

public class main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		// victory 1 or defeat 0 save
		ArrayList<Integer> answer = new ArrayList<Integer>();// clear

		// ???????????????????????°
		int set = Integer.parseInt(br.readLine());
		// input Area
		for (int i = 0; i < set; i++) {
			// ??¨??????????????????????????????????????????
			// ??°?????????????????§???????????£?¨????????????????????????????????????????????????????????´?
			CardRummy cr = new CardRummy(br.readLine(), br.readLine());// clear

			// method?????????????????????????????????
			int result = cr.playtheGame();// debug chk point
			// ???????????????????´?
			answer.add(result);// clear
		}
		// output Area
		// ex : 10101010
		for (int i = 0; i < answer.size(); i++)
			System.out.println(answer.get(i));// clear
	} // main end
}// class end

class CardRummy {

	// declear
	static final int ONECARDSET = 9;
	// static final int CARDPAGE = 2;

	int[] cardR = new int[ONECARDSET];
	int[] cardG = new int[ONECARDSET];
	int[] cardB = new int[ONECARDSET];

	public CardRummy() {
	}// construct end

	public CardRummy(String tmpNum, String tmpColor) {// clear

		String[] transNum = tmpNum.split(" ");
		String[] transColor = tmpColor.split(" ");

		// ???????±??????£???????????????????????¨????????????????´?
		for (int i = 0; i < ONECARDSET; i++) {// debug chk point

			if (transColor[i].equals("R"))
				cardR[i] = Integer.parseInt(transNum[i]);
			else if (transColor[i].equals("G"))
				cardG[i] = Integer.parseInt(transNum[i]);
			else if (transColor[i].equals("B"))
				cardB[i] = Integer.parseInt(transNum[i]);
		}
	}// construct end

	public int playtheGame() {// clear
		int result = 0;

		// ??´???????\?
		Arrays.sort(cardR);
		Arrays.sort(cardG);
		Arrays.sort(cardB);

		// ??£????????????????¢????
		cardR = sameNumCard(cardR);
		cardG = sameNumCard(cardG);
		cardB = sameNumCard(cardB);

		// ????????????????????????????¢????
		cardR = serialNumCard(cardR);
		cardG = serialNumCard(cardG);
		cardB = serialNumCard(cardB);

		// ?????????????????´???????\?
		Arrays.sort(cardR);
		Arrays.sort(cardG);
		Arrays.sort(cardB);

		//Arraylist.sort?????´??????
		//???????????´???????????????????????§??????????????????????????????????????°?????????????????????
		if (cardR[8] == 0 && cardG[8] == 0 && cardB[8] == 0)
			result = 1;

		return result;

	}// method end

	public static int[] sameNumCard(int[] card) {// clear
		//3???for??????????????????????????????
		for (int i = 0; i < 7; i++) {
			for (int j = i + 1; j < 8; j++) {
				for (int k = j + 1; k < ONECARDSET; k++) {
					//??????????????????????????§????????????????????°
					if (card[i] == card[j] && card[j] == card[k]  ) {
						//?????????????????????????????????????????????
						if (card[i] != 0 && card[j] != 0 && card[k] != 0) {
							//????????§???????????????
							card[i] = 0;
							card[j] = 0;
							card[k] = 0;
						}
					}

				}
			}
		}
		return card;
	}// method end

	public static int[] serialNumCard(int[] card) {// clear
		//3???for??????????????????????????????
		for (int i = 0; i < 7; i++) {
			for (int j = i + 1; j < 8; j++) {
				for (int k = j + 1; k < ONECARDSET; k++) {
					//??????????????????????????§???????????????????¢?????????´???
					if (card[i] == card[j]-1 && card[i] ==card[k]-2 ) {
						//?????????????????????????????????????????????
						if (card[i] != 0 && card[j] != 0 && card[k] != 0) {
							//????????§???????????????
							card[i] = 0;
							card[j] = 0;
							card[k] = 0;
						}
					}
				}
			}
		}
		return card;
	}// method end
}// class end

Compiler output:
Main.java:9: error: class main is public, should be declared in a file named main.java
public class main {
       ^
1 error