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 <algorithm>
#include <set>
#include <string>
#include <cstring>
using namespace std;
struct node
{
string s1,s2;
int num;
}a[];
int main()
{
int n;
while(cin>>n){
for(int i=;i<n;i++){
cin>>a[i].s1>>a[i].s2;
a[i].num=;
}
int sum=;
for(int i=;i<n;i++){
int flag=;
for(int j=;j<a[i].s2.length();j++){
if(a[i].s2[j]==''){
flag=;
a[i].s2[j]='%';
}else if(a[i].s2[j]==''){
a[i].s2[j]='@';
flag=;
}
else if(a[i].s2[j]=='O'){
a[i].s2[j]='o';
flag=;
}
else if(a[i].s2[j]=='l'){
a[i].s2[j]='L';
flag=;
}
}
if(flag){
sum++;
a[i].num=flag;
}
}
if(sum>){
cout<<sum<<endl;
for(int i=;i<n;i++){
if(a[i].num==){
cout<<a[i].s1<<" "<<a[i].s2<<endl;
}
}
}
else if(n==) cout<<"There is "<<n<<" account and no account is modified"<<endl;
else if(n>||n==) cout<<"There are "<<n<<" accounts and no account is modified"<<endl;
}
return ;
}

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

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

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

  2. PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642 题目描述: The highest building in our city has ...

  3. PAT (Advanced Level) Practice 1008 Elevator (20 分) (模拟)

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

  4. PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642 题目描述: The task is really simple: ...

  5. PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642 题目描述: Shuffling is a procedure us ...

  6. PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642 题目描述: Being unique is so important to peo ...

  7. PAT (Advanced Level) Practice 1031 Hello World for U (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1031 Hello World for U (20 分) 凌宸1642 题目描述: Given any string of N (≥5) ...

  8. PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642 题目描述: People in Mars represent the c ...

  9. PAT (Advanced Level) Practice 1023 Have Fun with Numbers (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1023 Have Fun with Numbers (20 分) 凌宸1642 题目描述: Notice that the number ...

随机推荐

  1. 如何在git搭建自己博客

    1.安装Node.js和配置好Node.js环境,打开cmd命令行输入:node v.2.安装Git和配置好Git环境,打开cmd命令行输入:git --version.3.Github账户注册和新建 ...

  2. Coroutine 练习 1 - Coroutine Exercises 1

    Coroutine 练习 1 - Coroutine Exercises 1 字典中为动词 “to yield” 给出了两个释义:产出和让步.对于 Python 生成器中的 yield 来 说,这两个 ...

  3. lwip stats

    lwip统计量分两种,一种是lwip自己的,一种是snmp的. 直接用snmp的 /* ----------------------------------- ---------- Statistic ...

  4. pymongo(看后转载,在原基础上添加了类连接和简单调用)

    一.MongoDB 数据库操作 1. 连接数据库 import pymongo conn = pymongo.Connection() # 连接本机数据库 # conn = pymongo.Conne ...

  5. U盘制作macOS Sierra的启动盘

    1.macOS Sierra的几种安装方式 *开机时按住command+option+r 进行联网在线安装.PS:在网速好的情况还行,但是如果网络差的时候,它会让你崩溃的. *使用光盘进行安装. *今 ...

  6. C++ 常用编程--Swap函数有几种写法?

    C++ 常用编程--Swap函数有几种写法? 在说C++模板的方法前,我们先想想C语言里面是怎么做交换的. 举个例子,要将两个int数值交换,是不是想到下面的代码: void swap(int& ...

  7. 《Java 8 in Action》Chapter 12:新的日期和时间API

    在Java 1.0中,对日期和时间的支持只能依赖java.util.Date类.同时这个类还有两个很大的缺点:年份的起始选择是1900年,月份的起始从0开始. 在Java 1.1中,Date类中的很多 ...

  8. java工作流系统jflow表单引擎字段扩展组件介绍

    关键词:工作流快速开发平台  工作流流设计  业务流程管理   asp.net 开源工作流  bpm工作流系统  java工作流主流框架  自定义工作流引擎 表单设计器  流程设计器 装饰类图片 用于 ...

  9. 安装Matlab R2017a 出现 “弹出DVD1 并插入DVD2” 解决办法超简单

    打开此电脑 找到驱动器虚拟镜像 右击选择弹出 点击另一个文件装载 点击确定即可

  10. neo4j学习摘要

    参考 链接:https://gitbook.cn/books/5a33782c5778440a9d906017/index.html