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. 在centos6.3下安装php的Xdebug

    首先下载一个xdebug http://www.xdebug.org/docs/ 官网上有windos版本和linux源码版本的,我们下载一个源码包xdebug-2.2.5.tgz 然后进入安装流程 ...

  2. Hapi+MySql项目实战配置插件-加载文件渲染母版(三)

    加载插件 一般在其它node框架下,我们安装好插件直接require('插件')就能正常使用了,但是在Hapi下我们必须要Server.register()方法,才能正常使用插件.举个例子: serv ...

  3. VFP获取 SQL Server 的数据表、触发器、存储过程、视图等脚本

    本文代码转载自红雨先生 *-----------------------------------------------* SqlServer 相关函数*----------------------- ...

  4. Vue简介与基础

    一.什么是Vue.js Vue.js 是目前最火的一个前端框架,React是最流行的一个前端框架(React除了开发网站,还可以开发手机App, Vue语法也是可以用于进行手机App开发的,需要借助于 ...

  5. Eclipse 无法引用到Maven 解决方法

    问题描述:打开Eclipse进入java EE视图下,发现原有的Maven Dependencies目录不存在,显示的是org.maven.ide.eclipse.MAVEN2_CLASSPATH_C ...

  6. NOIP2012-------跳石头(C语言)

    #include<stdio.h> ]; int check(long mid, long n, long m) { long last, i, ans; last = a[]; ans ...

  7. Ubuntu 18.04 MATLAB 安装及配置

    转载请注明出处,谢谢 原创作者:Mingrui 原创链接:https://www.cnblogs.com/MingruiYu/p/12367846.html 本文要点: Ubuntu 18.04 安装 ...

  8. 通过LD_PRELOAD绕过disable_functions

    今天做靶场时遇到了一个情形:拿到了webshell,却不能执行任何命令,如图 后来百度知道了disable_functions功能,这类服务器针对命令执行函数做了防范措施 一般绕过思路是利用漏掉的函数 ...

  9. Cesium案例解析(五)——3DTilesPhotogrammetry摄影测量3DTiles数据

    目录 1. 概述 2. 案例 3. 结果 1. 概述 3D Tiles是用于传输和渲染大规模3D地理空间数据的格式,例如摄影测量,3D建筑,BIM / CAD,实例化特征和点云等.与常规的模型文件格式 ...

  10. nginx基础(一)

    一.nginx的安装.启动.停止及文件解读 yum -y install gcc gcc-c++ autoconf pcre-devel make automake yum -y install wg ...