public class RecursiveMystery {
    public static void main(String[] args) {
        // mystery1(3);
        // mystery2(4);
        mystery3("taco");
    }

    public static void mystery1(int n) {
        if (n <= 1) {
            System.out.print(n);
        } else {
            mystery1(n / 2);
            System.out.print(", " + n);
        }
    }

    public static void mystery2(int n) {
        if (n <= 0) {
            System.out.print("*");
        } else if (n % 2 == 0) {
            System.out.print("(");
            mystery2(n - 1);
            System.out.print(")");
        } else {
            System.out.print("[");
            mystery2(n - 1);
            System.out.print("]");
        }
    }

    public static void mystery3(String str) {
        if (!str.isEmpty()) {
            System.out.print(str.charAt(0));
            mystery3(str.substring(1));
            System.out.print(str.charAt(0));
        }
    }
}
