http://bailian.openjudge.cn/practice/2692
import java.util.Scanner;
public class Main{
static int status[] = new int[12];
static String left[] = new String[3];
static String right[] = new String[3];
static String result[] = new String[3];
static boolean Balanced(){
int i,k,leftW,rightW;
for ( i = 0; i < 3; i++) {
leftW = rightW = 0;
int len = left[i].length();
for (k = 0; k < len; k++) {
leftW += status[left[i].charAt(k) - 'A'];
rightW += status[right[i].charAt(k) - 'A'];
}
if (leftW > rightW && result[i].charAt(0) != 'u'){
return false;
}
if (leftW == rightW && result[i].charAt(0) != 'e'){
return false;
}
if (leftW < rightW && result[i].charAt(0) != 'd'){
return false;
}
}
return true;
}
public static void main(String[] args) {
int i,num;
Scanner sc = new Scanner(System.in);
num= sc.nextInt();
while (num>0){
num--;
for (i = 0; i<3 ; i++) {
String lleft = sc.next();
String rright = sc.next();
String rresult = sc.next();
left[i] = lleft;
right[i] = rright;
result[i] = rresult;
}
for ( i = 0; i < 12; i++) {
status