public int countPairs(String[] words) {
		int count = 0;
		for (int i = 0; i < words.length; i++) {
			for (int j = i + 1; j < words.length; j++) {
				char[] m = new char[255];
				char[] r = new char[255];
				boolean allHit = true;
				for (int k = 0; k < words[i].length(); k++) {
					if (m[words[i].charAt(k)] == 0 && r[words[j].charAt(k)] ==0) {
						m[words[i].charAt(k)] = words[j].charAt(k);
						r[words[j].charAt(k)] = words[i].charAt(k);
					} else {
						if (m[words[i].charAt(k)] != words[j].charAt(k) || r[words[j].charAt(k)] != words[i].charAt(k)) {
							allHit = false;
							break;
						}
					}
				}
				if (allHit) {
					count++;
				}
			}
		}
		return count;
	}