public class Anagram {
public static void main(String[] args) {
System.out.println("is Anagram >>>>" + isAnagram("aabs", "baas"));
}
private static boolean isAnagram(String s1, String s2) {
int[] count = new int[256];
boolean result = true;
for (int i = 0; i < s1.length(); i++) {
count[s1.charAt(i)]++;
count[s2.charAt(i)]--;
}
for (int i = 0; i < count.length; i++) {
if(count[i] !=0) {
result =false;
}
}
return result;
}
}