import java.io.*;
import java.util.*;

public class Gen {

    static int tests = 1;
    static Random rnd = new Random(123);
    final static int MAX = (int) 1e5;
    final static int MAX_SUM_LEN = 5 * (int) 1e5;

    public void writeTest(ArrayList<String> test) throws IOException {
        PrintWriter out = new PrintWriter("../tests/"
                + String.format("%02d", tests++));
        out.println(test.size());
        for (int i = 0; i < test.size(); i++) {
            out.println(test.get(i));
        }
        out.close();
    }

    public ArrayList<String> getExample() {
        ArrayList<String> res = new ArrayList<>();
        res.add("aaaaaa");
        res.add("abacaba");
        res.add("aabaa");
        res.add("aba");
        return res;
    }

    String genRandomString(int n, int MAX) {
        char[] res = new char[n];
        for (int i = 0; i < n; i++)
            res[i] = (char) ('a' + rnd.nextInt(MAX));
        return new String(res);
    }

    String genRandomString2(int n) {
        char[] res = new char[n];
        for (int i = 0; i < n; i++)
            res[i] = rnd.nextDouble() < 0.001 ? 'b' : 'a';
        return new String(res);
    }

    String genTueMorseString(int n) {
        char[] res = new char[n];
        for (int i = 0; i < n; i++)
            res[i] = (Integer.bitCount(i) % 2) == 0 ? 'a' : 'b';
        return new String(res);
    }

    ArrayList<String> getRandomTestTueMorse() {
        String ss = genTueMorseString(MAX);
        ArrayList<String> res = new ArrayList<>();
        int su = 0;
        while (su <= MAX_SUM_LEN && res.size() < MAX) {
            int from = rnd.nextInt(ss.length());
            int to = rnd.nextInt(ss.length());
            if (to < from) {
                int tmp = from;
                from = to;
                to = tmp;
            }
            String tmp = ss.substring(from, to);
            su += tmp.length();
            if (su <= MAX_SUM_LEN)
                res.add(tmp);
        }
        return res;
    }

    ArrayList<String> getRandomTest(int len, int cntChars) {
        ArrayList<String> res = new ArrayList<>();
        int su = 0;
        while (su <= MAX_SUM_LEN && res.size() < MAX) {
            String tmp = genRandomString(1 + rnd.nextInt(len), cntChars);
            su += tmp.length();
            if (su <= MAX_SUM_LEN)
                res.add(tmp);
        }
        return res;
    }
    
    ArrayList<String> getRandomTest2(int len) {
        ArrayList<String> res = new ArrayList<>();
        int su = 0;
        while (su <= MAX_SUM_LEN && res.size() < MAX) {
            String tmp = genRandomString2(1 + rnd.nextInt(len));
            su += tmp.length();
            if (su <= MAX_SUM_LEN)
                res.add(tmp);
        }
        return res;
    }

    private void gen() throws IOException {
        File dir = new File("../tests");
        if (!dir.exists()) {
            dir.mkdir();
        }
        writeTest(getExample());
        for (int i = 0; i < 5; i++)
            writeTest(getRandomTest(20, 1 + rnd.nextInt(25)));
        for (int i = 0; i < 5; i++)
            writeTest(getRandomTest(12345, 1 + rnd.nextInt(25)));
        for (int i = 0; i < 2; i++)
            writeTest(getRandomTest(1234, 1));
		for (int i = 0; i < 2; i++)
            writeTest(getRandomTest(5, 1));
        for (int i = 0; i < 5; i++)
            writeTest(getRandomTest(1000, 2));
        for (int i = 0; i < 3; i++)
            writeTest(getRandomTestTueMorse());
        for (int i =0 ; i < 5; i++)
            writeTest(getRandomTest2(100));
        for (int i =0 ; i < 5; i++)
            writeTest(getRandomTest2(10000));
    }

    public static void main(String[] args) throws IOException {
        new Gen().gen();
    }
}
