注意下单复数
#include<bits/stdc++.h> using namespace std; pair<string,string>pa; int main() { int n; scanf("%d",&n); vector<pair<string,string> >vec; for(int i=0;i<n;i++){ char a[20],b[20]; scanf("%s %s",a,b); bool flag=false; for(int j=0;b[j];j++){ if(b[j]=='l'){ b[j]='L'; flag=true; } else if(b[j]=='1'){ b[j]='@'; flag=true; } else if(b[j]=='0'){ b[j]='%'; flag=true; } else if(b[j]=='O'){ b[j]='o'; flag=true; } } if(flag) vec.push_back(make_pair(a,b)); } if(vec.size()==0){ if(n==1) printf("There is %d account and no account is modified ",n); else printf("There are %d accounts and no account is modified ",n); } else{ printf("%d ",vec.size()); for(int i=0;i<vec.size();i++){ cout<<vec[i].first<<" "<<vec[i].second<<endl; } } return 0; }
其实没必要用vector<pari<string,string>> 直接用vector<string> 即可 把空格也当成字符串放在一个字符串里