class Anagrams {

    public static List<String> generate(String input) {
        List<String> anagrams = new ArrayList<String>();

        char[] inputChars = input.toCharArray();

        for (int i = 0; i < total(input); i++) {
            int movePosition = i < input.length() ? i : 0;
            char move = inputChars[movePosition];
            char replace = inputChars[1];
            inputChars[movePosition] = replace;
            inputChars[1] = move;

            String output = String.valueOf(inputChars);

            anagrams.add(output);
        }

        return anagrams;
    }

}