package net.ipipip0129.yukicoder.no701; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num_cnt = scan.nextInt(); CreateMoji createMoji = new CreateMoji(); for (int i = 0; i < num_cnt - 1; i++) { String moji = createMoji.createNextMoji('a', 'a'); System.out.println(moji); } System.out.println(createMoji.createNextMoji('a', 'n')); } } class CreateMoji { private int[] integer_array; CreateMoji() { this.integer_array = new int[18]; } public String createNextMoji(char beginChar, char endChar) { StringBuilder sb = new StringBuilder(); sb.append(beginChar); for (int i = 0; i < 18; i++) { sb.append(Character.toChars(97 + integer_array[i])); } sb.append(endChar); integer_array[0] += 1; moveUp(); return sb.toString(); } private void moveUp() { for (int i = 0; i < 18; i++) { if (integer_array[i] == 26) { integer_array[i + 1] += 1; integer_array[i] = 0; } } } }