@@ -0,0 +1,1530 @@
+import java.io.*;%0Aimport java.util.*;%0Aimport java.text.*;%0Aimport java.math.*;%0Aimport java.util.regex.*;%0A%0A// https://www.hackerrank.com/challenges/anagram%0Apublic class Solution %7B%0A%0A    static int anagaram(String s)%7B%0A        // sanity check:%0A        if (s == null %7C%7C s.length() %25 2 != 0)%0A            return -1;%0A        %0A        int count = 0;%0A        int%5B%5D no_of_letters = new int%5B26%5D;%0A        // for each letter, increment if it is found in string 1,%0A        //    and decrement if found in string 2%0A        for (int i = 0; i %3C s.length() / 2; i++) %7B%0A            no_of_letters%5Bs.charAt(i) - 'a'%5D++;%0A            no_of_letters%5Bs.charAt(s.length() - i - 1) - 'a'%5D--;%0A        %7D%0A        %0A        // add to the counter the letters that are in string 1 %0A        //     and that do not appear in string 2%0A        for (int i = 0; i %3C no_of_letters.length; i++)%0A            if (no_of_letters%5Bi%5D %3E 0) %0A                count+=no_of_letters%5Bi%5D;%0A%0A        // return the number of changes needed to make the anagram%0A        return count;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        // read the input from STDIN using a scanner%0A        Scanner in = new Scanner(System.in);%0A        int q = in.nextInt();%0A        for(int a0 = 0; a0 %3C q; a0++)%7B%0A            String s = in.next();%0A            int result = anagaram(s);%0A            // print to STDOUT the number of changes needed to transform%0A            //    string 1 in string 2%0A            System.out.println(result);%0A        %7D%0A        // close the scanner%0A        in.close();%0A    %7D%0A%7D%0A

- strings - anagram