#include <stdio.h>

struct c{

char s[25];
};

int main() {
    struct c S[1000], S1[1000];
    int n, sum=0;
    scanf("%d", &n);

    for(int i=0; i<n; i++) {
        scanf("%s", S[i].s);
        
    }
    for(int i=0; i<n-1; i++) {
        scanf("%s", S1[i].s);
    }

    for(int i=0; i<n-1; i++) {
        for(int j=0; j<n; j++) {
            int flag=1;
            if(S1[i].s[0]==S[j].s[0]) {
                //printf("%d %d :", i,j);
                for(int k=0; S1[i].s[k]; k++) {
                    //printf("%c %c\n", S1[i].s[k],S[j].s[k]);
                    if(S1[i].s[k]!=S[j].s[k]) { flag=0; break;}
                }
                if(flag) {
                    sum+=j;
                    //printf("%d ", j);
                    break;
                }
            }
        }
    }
    //printf("남은 번호 %d",n*(n-1)/2-sum );
    printf("%s", S[n*(n-1)/2-sum].s);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: