// Arup Guha
// 10/10/2023
// Solution to COP 3502 Section 1 Exam 1 Part B Question 1
#include <stdio.h>
#define SIZE 10

void go(char* str, int k, int n);

// Set up
int main() {
    char str[SIZE+1];
    str[SIZE] = '\0';
    go (str, 0, SIZE);
    return 0;
}

// Prints each possible string with the first k characters fixed.
void go(char* str, int k, int n) {

    // String is filled in, print it.
    if (k == n) {
        printf("%s\n", str);
        return;
    }

    // First try 'A' in slot k.
    str[k] = 'A';
    go(str, k+1, n);

    // Then 'B'.
    str[k] = 'B';
    go(str, k+1, n);
}
