下面是我的代码,提交后显示回答错误,请大神指明.
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
static String l1 = null;
static String r1 = null;
static Set<String> tList = new HashSet<String>();//真币
static Set<String> lList = new HashSet<String>();//有轻假币嫌疑
static Set<String> wList = new HashSet<String>();//有重假币嫌疑
private static void even(){
int l =l1.length();
String[] le = l1.split("");
String[] re = r1.split("");
for(int i = 0 ; i <l ; i++){
tList.add(le[i+1]);
tList.add(re[i+1]);
}
}
private static void up(){
int l = l1.length();
String[] le = l1.split("");
String[] re = r1.split("");
for(int i = 0 ; i <l ; i++){
wList.add(le[i+1]);
lList.add(re[i+1]);
}
}
private static void down(){
int l = l1.length();
String[] le = l1.split("");
String[] re = r1.split("");
for(int i = 0 ; i <l ; i++){
lList.add(le[i+1]);
wList.add(re[i+1]);
}
}
public static void main(String[] args) {
Scanner sca = new Scanner(System.in);
int count = sca.nextInt(); // 输入判断次数
for(int x = 0 ; x < count ; x++){
lList.clear();
wList.clear();
tList.clear();
for(int i = 0 ; i <3 ; i++){
l1 = sca.next();
r1 = sca.next();
String f1 = sca.next();
sca.nextLine();
if(f1.equals("even")){
even();
}else if (f1.equals("down")){
down();
}else{
up();
}
}
wList.removeAll(tList);
lList.removeAll(tList);
if(lList.size() != 0){
lList.removeAll(tList);
for( String s : lList){
System.out.println(s+" is the counterfeit coin and it is light. ");
}
}
if(wList.size() != 0){
wList.removeAll(tList);
for( String s : wList){
System.out.println(s+" is the counterfeit coin and it is heavy. ");
}
}
}
sca.close();
}
}