public static void main(String[] str) throws IOException {

		BufferedReader br = new BufferedReader(new FileReader("words.txt"));
		List<String> anagrams = new ArrayList<>();
		String line = br.readLine();
		String[] words = line.split(",");
		SIZE = words.length;
		for (int i = 0; i < SIZE; i++) {
			for (int j = 0; j < SIZE; j++) {
				if (i != j) {

					if (areAnagrams(words[i], words[j])) {
						if (!alreadyPresent(anagrams, words[i])) {
							anagrams.add(words[i] + "," + words[j] + ","
									+ words[j].length());
						}
					}

				}
			}
		}
		int largestSize = 1;
		for (int i = 0; i < anagrams.size(); i++) {
			int curSize = anagrams.get(i).split(",")[0].length();
			if (curSize > largestSize) {
				largestSize = curSize;
			}
		}
		largestSize -= 2;
		for (int i = 0; i < anagrams.size(); i++) {
			String cur = anagrams.get(i).split(",")[0];
			if (anagrams.get(i).split(",")[0].length() == largestSize) {
				System.out.println(anagrams.get(i).split(",")[0] + " "
						+ anagrams.get(i).split(",")[1]);
			}
		}
		// getLargestSquare(largestSize, anagrams);
		getLargestSquareXXX(largestSize, anagrams);
		System.out.println(anagrams.size() + "Largest:" + largestSize);
	}