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
题目分析:水题 细心就好
 #define _CRT_SECURE_NO_WARNINGS
#include <climits>
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
struct S {
string s1, s2;
};
vector<S> V;
int main()
{
int N;
cin >> N;
string s1, s2;
for (int i = ; i < N; i++)
{
int flag = ;
cin >> s1 >> s2;
for (int j = ; j < s2.length(); j++)
{
if (s2[j] == '')
{
flag = ;
s2[j] = '@';
}
else if (s2[j] == '')
{
flag = ;
s2[j] = '%';
}
else if (s2[j] == 'l')
{
flag = ;
s2[j] = 'L';
}
else if (s2[j] == 'O')
{
flag = ;
s2[j] ='o';
}
}
if (flag)
V.push_back({ s1,s2 });
}
if (V.size() == )
{
if (N == )
cout << "There is 1 account and no account is modified";
else
printf("There are %d accounts and no account is modified", N);
}
else
{
cout << V.size() << endl;
for (auto it : V)
cout << it.s1 << " " << it.s2<<endl;
}
}

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 (Advanced Level) Practice 1035 Password (20 分) 凌宸1642

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

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

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

  4. PAT Advanced 1035 Password (20 分)

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

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

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

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

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

  7. PAT甲题题解-1035. Password (20)-水

    题意:给n个用户名和密码,把密码中的1改为@,0改为%,l改为L,O改为o. 让你输出需要修改密码的用户名个数,以及对应的用户名和密码,按输入的顺序.如果没有用户需要修改,则输出对应的语句,注意单复数 ...

  8. 【PAT】1035. Password (20)

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

  9. 1035 Password (20)

    #include <stdio.h> #include <string.h> struct MyStruct { ]; ]; bool changed; }; int main ...

随机推荐

  1. django 从零开始 2迁移模型数据到数据库中和admin初识

    和flask 一样 如果模型models 发生改动,则需要进行一个迁移数据库,但是我还没有想讲到那么深入,现在模型是django自带的一些sessiong,damin之类的模型 所以如果你想进去adm ...

  2. 5G 将带给程序员哪些新机会呢?

    5G,第 5 代移动通信技术,华为在此领域远远领先同行,这也让它成了中美贸易战的最前线.我的第一份工作就在通信行业,当时电信标准都在欧美企业手里,国内企业主要是遵照标准研发软硬件设备,核心芯片靠进口. ...

  3. Top命令你最少要了解到这个程度

    top命令几乎是每个程序员都会用到的Linux命令.这个命令用来查看Linux系统的综合性能,比如CPU使用情况,内存使用情况.这个命令能帮助我快速定位程序的性能问题. 虽然这个命令很重要,但是之前对 ...

  4. C++ 【静态成员】static修饰的成员

    首先,我们先通过字面意思来理解... 成员:成员变量.成员函数. static  修饰成员变量,还有修饰成员函数. static  声明为静态的,称为静态成员.不管这个类创建了多少个对象,静态成员只有 ...

  5. Elasticsearch系列---多字段搜索

    概要 本篇介绍一下multi_match的best_fields.most_fields和cross_fields三种语法的场景和简单示例. 最佳字段 bool查询采取"more-match ...

  6. File的获取功能(新手)

    //导入包.import java.io.File;/*File的获取功能*///创建的一个类.public class zylx2 { //公共静态的主方法. public static void ...

  7. 网络安全从入门到精通 (第二章-2) 后端基础SQL—MySQL数据库简介及SQL语法

    本文内容: 什么是数据库 常见数据库 数据库的基本知识 基本SQL语法 1,什么是数据库? 数据库就是将大量数据保存起来,通过计算机加工,可以高效访问的数据聚合. 数据库就是长期存储在计算机内,有组织 ...

  8. redis相关命令及应用场景

    Redis的应用场景 (1)         配合关系型数据库做高速缓存 l  高频次,热门访问的数据,降低数据库IO l  高频次,热门访问的数据,降低数据库IO (2)         由于其拥有 ...

  9. 远程调试docker构建的weblogic

    环境信息 OSType: CentOS Linux 7 (Core) x86_64 3.10.0-957.21.3.el7.x86_64 DockerVersion: 19.03.8 Mirrors: ...

  10. 重磅!!!一文总结Pytorch的8张思维导图!

    本文以思维导图的形式,为大家介绍了深度学习的核心内容,主要包括:深度学习与Pytorch简介.词向量.用pytorch处理常见的NLP和CV任务.图片风格迁移和GAN.Seq2Seq与Attentio ...