Groups of Special-Equivalent Strings

给一个string组, 找其中有几对儿group, 每个group中的string交换奇数or偶数index上的char后相等. 直接counting就可以.

class Solution {
    public int numSpecialEquivGroups(String[] A) {
        Set<String> seen = new HashSet();
        for (String S: A) {
            int[] count = new int[52];
            for (int i = 0; i < S.length(); ++i)
                count[S.charAt(i) - 'a' + 26 * (i % 2)]++;
            seen.add(Arrays.toString(count));
        }
        return seen.size();
    }
}