输入字符串a
输入字符串b
记住是字符串中的字符匹配 而非两个字符串简简单单匹配
这题是a中所有的字符在没在b中出现过
所以依照题目所述,本题迎刃而解
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext 和 hasNextLine 的区别
while (in.hasNextLine()) { // 注意 while 处理多个 case
String[] a = in.nextLine().split("");//字符串变成字符串数组
String b = in.nextLine();//输入第二个字符出阿门
int count=0;//计数a中字符有多少个在b中存在
for(String res:a){
if(b.contains(res))count++;//a中字符在b字符串中存在,count加1
}
System.out.println(count==a.length);//如果a中全部字符都在b中则两者相等返回true,否则为false
}
}