class Solution {
public boolean canConstruct(String ransomNote, String magazine) {
int[] letter1 = new int[123];
int[] letter2 = new int[123];
for (int i = 0; i < ransomNote.length(); i++){
letter1[ransomNote.charAt(i)]++;
}
for (int i = 0; i < magazine.length(); i++){
letter2[magazine.charAt(i)]++;
}
for (int i = 0; i < ransomNote.length(); i++){
if (letter1[ransomNote.charAt(i)] > letter2[ransomNote.charAt(i)]){
return false;
}
}
return true;
}
}