题解 | #字符串字符匹配#
字符串字符匹配
http://www.nowcoder.com/practice/22fdeb9610ef426f9505e3ab60164c93
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while (scan.hasNext()) {
char[] mchrs = scan.nextLine().toCharArray();
char[] schrs = scan.nextLine().toCharArray();
System.out.println(process(mchrs, schrs));
}
}
public static boolean process(char[] mchrs, char[] schrs) {
int[] nums = new int[26];
for (char chr : schrs) {
nums[chr - 'a']++;
}
for (char chr : mchrs) {
if (nums[chr - 'a'] == 0) {
return false;
}
}
return true;
}
}