PAT 1035 Password

#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
vector<pair<string,string > > vec;
pair<string,string> tmp;
int num;
cin >> num;
int flag = 0;
int count = 0;
for (int i = 0; i < num; ++i)
{
cin >> tmp.first >> tmp.second;

for (int j = 0; j < tmp.second.size(); ++j)
{
switch (tmp.second[j])
{


case '1':
tmp.second[j] = '@';
flag = 1;
break;
case '0':
tmp.second[j] = '%';
flag = 1;
break;
case 'l':
tmp.second[j] = 'L';
flag = 1;
break;
case'O':
tmp.second[j] = 'o';
flag = 1;
}
}
if (flag)
{
count++;
flag = 0;
vec.push_back(tmp);
}
}
if (count)
{
cout << count << endl;
for (int k = 0; k < count; ++k)
{
cout << vec[k].first <<" "<<vec[k].second<<endl;
}
}
else if(num == 1)
{
cout << "There is 1 account and no account is modified" << endl;
}
else
{
cout << "There are "<<num<<" accounts and no account is modified"<<endl;
}


return 0;
}
阅读更多
文章标签: PAT
个人分类: PAT
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭