import java.util.Scanner;

public class Anagrams {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		System.out.print("Enter a string: "); // Step 3
		String response = scanner.nextLine();

		Permutations perm = new Permutations(response);

		String[] allPerms = perm.getPermutations();

		WordList dict = new WordList(279456, "english.txt");

		for (int x = 0; x < allPerms.length; x++) {
			if (dict.isInList(allPerms[x])) {
				System.out.println(allPerms[x]);
			}
		}

	}
}
