题解:P14749 名字取好了

· · 题解

思路

读入三个字符串,分别表示原网站上的 first name,last name,接收状态,如果接受状态为 Rejected 则按原网站上的 last name,first name 的顺序输出;否则按原网站上的 last name,first name 的顺序输出

代码

#include<bits/stdc++.h>

using namespace std;

const int N = 1010;
char a[N],b[N],c[N];

int main(){
    scanf("%s%s%s",a,b,c);
    if(strcmp(c,"Rejected") == 0){
        // 不想多写一个if,就用了swap
        swap(a,b);
    }
    printf("%s %s",a,b);
    return 0;
}