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. Golang调用Dll案例

    Golang调用Dll案例 前言 在家办公已经两个多星期了,目前最大的困难就是网络很差.独自一个人用golang开发调用dll的驱动程序.本来就是半桶水的我,还在为等待打开一个页面而磨平了耐心.本想依 ...

  2. 【5min+】 设计模式的迷惑?Provider vs Factory

    系列介绍 [五分钟的dotnet]是一个利用您的碎片化时间来学习和丰富.net知识的博文系列.它所包含了.net体系中可能会涉及到的方方面面,比如C#的小细节,AspnetCore,微服务中的.net ...

  3. Python 实现转堆排序算法原理及时间复杂度(多图解释)

    原创文章出自公众号:「码农富哥」,欢迎转载和关注,如转载请注明出处! 堆基本概念 堆排序是一个很重要的排序算法,它是高效率的排序算法,复杂度是O(nlogn),堆排序不仅是面试进场考的重点,而且在很多 ...

  4. HTTP 中 GET 与 POST 的区别(详解)

    我们都知道GET和POST是HTTP请求的两种基本方法,最直观的区别就是GET把参数包含在URL中,POST通过request body传递参数. 很多权威网站总结出的他们的区别: GET在浏览器回退 ...

  5. python3-cookbook笔记:第九章 元编程

    python3-cookbook中每个小节以问题.解决方案和讨论三个部分探讨了Python3在某类问题中的最优解决方式,或者说是探讨Python3本身的数据结构.函数.类等特性在某类问题上如何更好地使 ...

  6. 带输入提示的搜索框ajax请求

    先放图 首先要引用的文件有: base.css  https://www.cnblogs.com/chenyingying0/p/12363689.html jquery.js transition. ...

  7. 简单了解css3样式表写法和优先级

    css3和css有什么区别?首先css3是css(层叠样式表)技术的升级版本,而css是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言. ...

  8. jQuery的动画以及扩展功能

    动画DOM及CSS操作 自定义动画 animate(最终css状态,时间) 这个最终css状态是一个对象 <!DOCTYPE html> <html lang="en&qu ...

  9. Android中通过Java代码实现ScrollView滚动视图-以歌词滚动为例

    场景 实现效果如下 注: 博客: https://blog.csdn.net/badao_liumang_qizhi 关注公众号 霸道的程序猿 获取编程相关电子书.教程推送与免费下载. 实现 将布局改 ...

  10. 获取Data和Log默认路径

    使用SERVERPROPERTY()来得到Data和Log的默认路径: InstanceDefaultDataPath和InstanceDefaultLogPath分别返回默认数据和日志目录. DEC ...