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 N lines 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<vector>
using namespace std;
struct user{
string id;
string pw;
};
int main() {
int T;
cin>>T;
user tmp;
vector<user> vec;
bool isConfused=false;
for(int i=;i<T;i++){
isConfused=false;
cin>>tmp.id>>tmp.pw;
for(int i=;i<tmp.pw.length();i++){
switch(tmp.pw[i]){
case '':
tmp.pw[i]='@';
isConfused=true;
break;
case '':
tmp.pw[i]='%';
isConfused=true;
break;
case 'l':
tmp.pw[i]='L';
isConfused=true;
break;
case 'O':
tmp.pw[i]='o';
isConfused=true;
break;
}
}
if(isConfused) vec.push_back(tmp);
}
if(vec.size()==) {
if(T==) printf("There is 1 account and no account is modified");
else printf("There are %d accounts and no account is modified",T);
/**需要注意account和accounts是不一样的*/
}
else{
cout<<vec.size()<<endl;
for(int i=;i<vec.size();i++){
cout<<vec[i].id<<" "<<vec[i].pw<<endl;
}
}
system("pause");
return ;
}

PAT Advanced 1035 Password (20 分)的更多相关文章

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

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

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

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

  3. PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...

  4. PAT (Advanced Level) Practice 1035 Password (20 分)

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

  5. 【PAT甲级】1035 Password (20 分)

    题意: 输入一个正整数N(<=1000),接着输入N行数据,每行包括一个ID和一个密码,长度不超过10的字符串,如果有歧义字符就将其修改.输出修改过多少组密码并按输入顺序输出ID和修改后的密码, ...

  6. 【PAT】1035. Password (20)

    题目:http://pat.zju.edu.cn/contests/pat-a-practise/1035 分析:简单题.直接搜索,然后替换,不会超时,但是应该有更好的办法. 题目描述: To pre ...

  7. 1035 Password (20分)(水)

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

  8. PAT Advanced 1008 Elevator (20 分)

    The highest building in our city has only one elevator. A request list is made up with N positive nu ...

  9. PAT Advanced 1077 Kuchiguse (20 分)

    The Japanese language is notorious for its sentence ending particles. Personal preference of such pa ...

随机推荐

  1. mysql中查看ef或efcore生成的sql语句

    http://www.solves.com.cn/it/sjk/MYSQL/2019-07-01/1336.html 涉及命令 1.开启general log模式 MySQL>set globa ...

  2. 转 实例具体解释DJANGO的 SELECT_RELATED 和 PREFETCH_RELATED 函数对 QUERYSET 查询的优化(二)

    https://blog.csdn.net/cugbabybear/article/details/38342793 这是本系列的第二篇,内容是 prefetch_related() 函数的用途.实现 ...

  3. saml2协议sp-initial登录过程

    登录过程如下所示: 一次完整的saml认证过程,包括一次samlrequest和samlresponse, 首先用户如果想访问一个sp,sp会先检验用户是否登录,如果用户已经登录,即可以正常访问sp的 ...

  4. 2018 icpc 沈阳

    https://codeforces.com/gym/101955 J 签到 #include<iostream> #include<cstring> #include< ...

  5. SpringIOC容器创建过程

    在测试时,经常使用这种方式来创建spring容器 //创建基于注解的springIOC容器 ApplicationContext applicationContext = new Annotation ...

  6. Openstack 实现技术分解 (3) 开发工具 — VIM & dotfiles

    目录 目录 前文列表 扩展阅读 前言 插件管理 Vundle 主题 Solarized 浏览项目目录结构 Nerdtree Symbol 窗口 Tagbar 文件模糊查询 CtrlP 代码补全 You ...

  7. 阶段2 JavaWeb+黑马旅游网_15-Maven基础_第3节 maven标准目录结构和常用命令_07maven常用命令

    以给的hellowordl的的代码为例. src/main/java下,这是主业务逻辑代码 里面的内容只有一个jsp的跳转 测试包下: 里面很简单的就输出了一句话 复制项目的目录 先cd进入复制的这个 ...

  8. 九:flask-response响应

    1.如果返回的是个合法的响应对象,则直接返回 同时,也可以在response里面做一些操作,比如增加cookie 2.如果返回的是一个字符串,那么flask会重新创建一个werkzeug,wrappe ...

  9. docker运行haproxy 自动生成配置

    #根据参数,shell自动生成haproxy配置 #为方便部署,特意做了个haproxy镜像 #Haproxy run as docker #运行实例 run #!/bin/bash #docker ...

  10. cannot assign to struct field xxx in map

    golang 中对 map 类型中的 struct 赋值报错 type s struct{ name string age int}func main(){ a := map[string]s{ &q ...