@@ -0,0 +1,1649 @@
+package ru.job4j.test;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.TreeMap;%0A%0Apublic class SameLetters %7B%0A%0A    private char%5B%5D word1 = %22mama%22.toCharArray();%0A    private char%5B%5D word2 = %22amam%22.toCharArray();%0A    private char%5B%5D word3 = %22amama%22.toCharArray();%0A%0A    Map%3CCharacter, Integer%3E lettersInWord1 = new HashMap%3CCharacter, Integer%3E();%0A%0A%0A    /**%0A     * method to check if the words contains the same letters.%0A     *%0A     * @return result.%0A     */%0A    public boolean isSameLetters() %7B%0A%0A        lettersInWord1 = new TreeMap%3C%3E();%0A        for (char tempor : word1) %7B%0A            lettersInWord1.put(tempor, 1);%0A        %7D%0A        Map%3CCharacter, Integer%3E lettersInWord3 = new TreeMap%3C%3E();%0A        for (char temporar : word3) %7B%0A%0A            lettersInWord3.put(temporar, 1);%0A        %7D%0A        return lettersInWord1.equals(lettersInWord3);%0A    %7D%0A%0A    /**%0A     * method to check if the words are anagramms.%0A     *%0A     * @return result.%0A     */%0A    public boolean isAnagramma() %7B%0A%0A        for (char temp : word1) %7B%0A            int count = 1;%0A            if (lettersInWord1.containsKey(temp)) %7B%0A                count = lettersInWord1.get(temp) + 1;%0A            %7D%0A            lettersInWord1.put(temp, count);%0A        %7D%0A        for (char tempr : word2) %7B%0A            int count = -1;%0A            if (lettersInWord1.containsKey(tempr)) %7B%0A                count = lettersInWord1.get(tempr) - 1;%0A            %7D%0A            lettersInWord1.put(tempr, count);%0A        %7D%0A%0A        for (char c : lettersInWord1.keySet()) %7B%0A            if (lettersInWord1.get(c) != 0) %7B%0A                return false;%0A            %7D%0A        %7D%0A%0A        return true;%0A%0A    %7D%0A%0A%7D%0A

testTask 1