题解
2023-07-07 11:44:52
发布于:上海
35阅读
0回复
0点赞
#include <iostream>
#include<algorithm>
using namespace std;
struct p{
string b,c;
}a[10005];
int main(){
string s,j,k,l;
cin>>s;
int n;
cin>>n;
int flag = 1,idx=1;
for(int i=1;i<=n;i++){
cin>>j>>k>>l;
if(l==s){
flag = 0;
int len = k.length();
for(int i=0;i<len;i++){
if(k[i]>='a' and k[i]<='z')k[i]-=32;
else if(k[i]>='A' and k[i]<='Z')k[i]+=32;
}
a[idx].b=j;
a[idx].c=k;
idx++;
}
}
if(flag==1){
cout<<"empty";
return 0;
}
for(int i=1;i<idx;i++){
cout<<a[i].b<<" "<<a[i].c<<endl;
}
return 0;
}
这里空空如也
有帮助,赞一个