To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L in lowercase), or 0 (zero) from O (o in uppercase). One solution is to replace 1 (one) by @0 (zero) by %l by L, and O by o. Now it is your job to write a program to check the accounts generated by the judge, and to help the juge modify the confusing passwords.

Input Specification:

Each input file contains one test case. Each case contains a positive integer N (≤), followed by Nlines of accounts. Each account consists of a user name and a password, both are strings of no more than 10 characters with no space.

Output Specification:

For each test case, first print the number M of accounts that have been modified, then print in the following M lines the modified accounts info, that is, the user names and the corresponding modified passwords. The accounts must be printed in the same order as they are read in. If no account is modified, print in one line There are N accounts and no account is modified where N is the total number of accounts. However, if N is one, you must print There is 1 account and no account is modified instead.

Sample Input 1:

3
Team000002 Rlsp0dfa
Team000003 perfectpwd
Team000001 R1spOdfa

Sample Output 1:

2
Team000002 RLsp%dfa
Team000001 R@spodfa

Sample Input 2:

1
team110 abcdefg332

Sample Output 2:

There is 1 account and no account is modified

Sample Input 3:

2
team110 abcdefg222
team220 abcdefg333

Sample Output 3:

There are 2 accounts and no account is modified
 #include <iostream>
#include <string>
#include <vector>
using namespace std;
int N;
int main()
{
cin >> N;
vector<pair<string, string>>res;
for (int i = ; i < N; ++i)
{
bool flag = false;
string name, password;
cin >> name >> password;
for (int j = ; j < password.length(); ++j)
{
if (password[j] == '')
{
flag = true;
password[j] = '@';
}
else if (password[j] == '')
{
flag = true;
password[j] = '%';
}
else if (password[j] == 'l')
{
flag = true;
password[j] = 'L';
}
else if (password[j] == 'O')
{
flag = true;
password[j] = 'o';
}
}
if (flag)
res.push_back(make_pair(name, password));
}
if (res.size() == )
{
if (N > )
cout << "There are " << N << " accounts and no account is modified" << endl;
else
cout << "There is " << N << " account and no account is modified" << endl;
}
else
{
cout << res.size() << endl;
for (auto ptr : res)
cout << ptr.first << " " << ptr.second << endl;
}
return ;
}

PAT甲级——A1035 Password的更多相关文章

  1. PAT 甲级 1035 Password (20 分)

    1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords for th ...

  2. PAT 甲级 1035 Password

    https://pintia.cn/problem-sets/994805342720868352/problems/994805454989803520 To prepare for PAT, th ...

  3. PAT 甲级 1035 Password (20 分)(简单题)

    1035 Password (20 分)   To prepare for PAT, the judge sometimes has to generate random passwords for ...

  4. PAT甲级——1035 Password (20分)

    To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...

  5. PAT甲级题解(慢慢刷中)

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6102219.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  6. A1035 Password (20)(20 分)

    A1035 Password (20)(20 分) To prepare for PAT, the judge sometimes has to generate random passwords f ...

  7. PAT甲级代码仓库

    大道至简,知易行难.希望能够坚持刷题. PAT甲级真题题库,附上我的代码. Label Title Score Code Level 1001 A+B Format 20 1001 * 1002 A+ ...

  8. PAT甲级1131. Subway Map

    PAT甲级1131. Subway Map 题意: 在大城市,地铁系统对访客总是看起来很复杂.给你一些感觉,下图显示了北京地铁的地图.现在你应该帮助人们掌握你的电脑技能!鉴于您的用户的起始位置,您的任 ...

  9. PAT甲级1127. ZigZagging on a Tree

    PAT甲级1127. ZigZagging on a Tree 题意: 假设二叉树中的所有键都是不同的正整数.一个唯一的二叉树可以通过给定的一对后序和顺序遍历序列来确定.这是一个简单的标准程序,可以按 ...

随机推荐

  1. Java-Maven-pom.xml-project-packaging:packaging(war/jar)

    ylbtech-Java-Maven-pom.xml-project-packaging:packaging(war/jar) 1.返回顶部 1.packaging 1.1 war <!-- 打 ...

  2. (20)Oracle函数

    substr 截取字段 substr(字符串,截取开始位置,截取长度) substr(str,n,m) 第二,三参数可以省略, 第二个参数为负数时表示从倒数第n位开始向后截取m个 round(str, ...

  3. JAVA入门各种API参考

    java sdk: https://docs.oracle.com/javase/8/docs/api/ servlet api: http://tomcat.apache.org/tomcat-8. ...

  4. Collection、Iterator、泛型初步

    java.util.Collection 集合层次的根接口 java.util.List extends Collection ArrayList implements List 常用方法 boole ...

  5. java中 ++a 与 a++ 的区别

    public static void main(String[] args) { int a = 5; a ++; System.out.println(a); int b = 5; ++ b; Sy ...

  6. Java工具之NotePad++使用技巧

    按住Alt键 拖动鼠标左键 批量添加 如,等 批量添加逗号, 下面, 竖排 变 横排 ctrl + f 使用正则表达式 \r\n 替换换行符 使用:sql语句中的 过滤条件 in中,往往适合范围查找 ...

  7. 逆元 组合A(n,m) C(n,m)递推 隔板法

    求逆元 https://blog.csdn.net/baidu_35643793/article/details/75268911 int inv[N]; void init(){ inv[] = ; ...

  8. Visual Studio 代码管理器svn插件下载

    环境:Visual Studio 2010 Visual Studio的svn插件叫做VisualSVN,可自行到VisualSVN官网上下载相应版本,也可以通过vs中找到相关插件. ps:vs其他的 ...

  9. 记 openSUSE 42.3 升级到Leap 15.0

    先将系统的软件更新到最新版本 sudo zypper update 删除42.3的软件源,若有其他数据源,如nginx的,也需要一并删除,可使用zypper lr -d 来查询 sudo zypper ...

  10. [JZOJ5232] 【NOIP2017模拟A组模拟8.5】带权排序

    题目 题目大意 有一个数列AAA,数列上的每个数都是在[li,ri][l_i,r_i][li​,ri​]范围内随机的数. 将这个数列进行稳定排序,得到每个位置在排序后的排名pip_ipi​. f(A) ...