AcWing 1519. 密码
原题链接
简单
作者:
Value
,
2020-06-01 09:07:05
,
所有人可见
,
阅读 391
#include <iostream>
#include <unordered_map>
#include <vector>
#include <cstdio>
using namespace std;
unordered_map<char, char> change;
void init(){
change['1'] = '@'; change['0'] = '%';
change['l'] = 'L'; change['O'] = 'o';
}
typedef pair<string, string> pii;
vector<pii> res;
int main(){
init();
int n;
cin >> n;
string user, pwd;
bool flag;
for(int i = 0; i < n; i ++ ){
cin >> user >> pwd;
flag = false;
for(int i = 0; i < pwd.size(); i ++ ){
if(change.find(pwd[i]) != change.end()){
pwd[i] = change[pwd[i]];
flag = true;
}
}
if(flag) res.push_back({user, pwd});
}
if(res.size() == 0){
if(n == 1) printf("There is %d account and no account is modified\n", n);
else printf("There are %d accounts and no account is modified\n", n);
}else{
cout << res.size() << endl;
for(auto it : res) cout << it.first << " " << it.second << endl;
}
return 0;
}