package task4;

import java.util.Arrays;

public class AnagrammCheckerAI {
    private String word0;
    private String word1;

    public AnagrammCheckerAI(String word0, String word1){
        this.word0 = word0;
        this.word1 = word1;
    }



    public boolean isAnagram() {
        if (word0 == null || word1 == null) {
            return false;
        }
        char[] chars0 = word0.toLowerCase().toCharArray();
        char[] chars1 = word1.toLowerCase().toCharArray();
        Arrays.sort(chars0);
        Arrays.sort(chars1);
        return Arrays.equals(chars0, chars1);
    }

}
