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. JPA使用中遇到Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: XXX is not mapped

    在写自定义查询时,Query注解中写的JPQL,表名和列名都应该是映射的Java类和属性,不能写表名或者字段名

  2. 大数据时代下EDM邮件营销的变革

    根据研究,今年的EDM邮件营销的邮件发送量比去年增长了63%,许多方法可以为你收集用户数据,这些数据可以帮助企业改善自己在营销中的精准度,相关性和执行力. 最近的一项研究表明,中国800强企业当中超过 ...

  3. pandas库简介和数据结构

    pandas简介 pandas是一个强大的Python数据分析的工具包.是基于Numpy来构件的. pandas提供快速.灵活和富有表现力的数据结构. 主要功能: 具备对其功能的数据结构DataFra ...

  4. Leon-ai on WSL

    这几天尝试了下Windows10的WSL,的确是良心产品,虽然还有很多待改进的地方(比如iptabeles之类的功能还未支持). 使用了WSL就避免安装双系统的繁琐,节省很多时间,而且因为是微软自家产 ...

  5. ffmpeg mp4 to wmv and wmv to mp4

    //大小=>变小ffmpeg -i 1.mp4 -b:v 2M -vcodec msmpeg4 -acodec wmav2 1_mp4.wmv//大小=>变大ffmpeg -i 1.mp4 ...

  6. 阶段3 1.Mybatis_01.Mybatis课程介绍及环境搭建_04.mybatis概述

  7. JS中数组的拷贝方法

    之前在写一个vue的计算属性时,大概是这样: computed: { updateList () { let newList = this.List /*do something*/ return n ...

  8. svn访问版本库时一直提示: please wait while the repository browser is initializing

    最近不知道做了什么操作,原来正常的SVN Check In/Out都无法正常操作. 正常Check In的动作,几秒钟就会操作完成,但是我却等了好久好久,然后提示Connection timed ou ...

  9. Pycharm激活方法(license server方法)

    pycharm所有版本 http://www.jetbrains.com/pycharm/download/previous.html 打开激活窗口 选择 Activate new license w ...

  10. 【MM系列】SAP OX09中的地址如何取

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP OX09中的地址如何取   ...