//
// Created by gs on 2026/3/5.
//

// HJ27 查找兄弟单词
#include <stdio.h>
#include <string.h>



int is_brother(char* a, char* b) {
    int i, j;
    char yy[11] = {0};
    if (strlen(a) != strlen(b)) {
        return -1;
    }

    if (strcmp(a, b) == 0) {
        return -2;
    }

    strcpy(yy, b);

    for (i = 0; i < strlen(a); i++) {
        char temp;
        for (j = i; j < strlen(yy); j++) {
            if (yy[j] == a[i]) {
                if (i == j) {
                    break;
                }
                temp = yy[i];
                yy[i] = yy[j];
                yy[j] = temp;
                break;
            }
        }
    }

    if (strcmp(a, yy) == 0)
        return 0;
    else {
        return -3;
    }

}

int main() {
    int i, j;
    int n;
    char x[11] = {0}, tmp[11] = {0};
    int k = 0;
    char buf[1003][11] = {0};
    char sort[1003][11] = {0};
    int flag = 0, count = 0;

    scanf("%d", &n);

    i = 0;
    while (scanf("%s", buf[i]) != EOF) { // 注意 while 处理多个 case
        i++;
        if (i == n)
            break;
    }

    scanf("%s", x);

    scanf("%d", &k);

    for (i = 0; i < n; i++) {
        flag = is_brother(x, buf[i]);

        if (flag == 0) {
            strcpy(sort[count], buf[i]);
            count++;
        }

    }

    printf("%d\n", count);
    if (k <= count) {
        for (i = 0; i < k; i++) {
            int min = i;
            for (j = i + 1; j < count; j++) {
                if (strcmp(sort[min], sort[j]) > 0) {
                    min = j;
                }
            }
            if (min != i) {
                strcpy(tmp, sort[min]);
                strcpy(sort[min], sort[i]);
                strcpy(sort[i], tmp);
            }
        }
        printf("%s", sort[k - 1]);
    }

    return 0;
}