题目描述
知识点
字符串处理
我的实现
码前思考
水题
代码实现
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <unordered_map>
using namespace std;
struct node{
string account;
string password;
node(string a,string p){
account = a;
password = p;
}
};
int n;
vector<node> vt;
unordered_map<char,char> mp={{'1','@'},{'0','%'},{'l','L'},{'O','o'}};
int main(){
scanf("%d",&n);
string account;
string password;
for(int i=0;i<n;i++){
cin>>account;
cin>>password;
bool flag=false;
for(int i=0;i<password.size();i++){
if(mp.count(password[i])!=0){
password[i] = mp[password[i]];
flag = true;
}
}
if(flag){
vt.push_back(node(account,password));
}
}
if(vt.size()==0){
if(n==1){
cout<<"There is 1 account and no account is modified"<<endl;
}else{
cout<<"There are "<<n<<" accounts and no account is modified"<<endl;
}
}else{
cout<<vt.size()<<endl;
for(int i=0;i<vt.size();i++){
cout<<vt[i].account<<" "<<vt[i].password<<endl;
}
}
return 0;
}
码后反思
还行