1035 Password (20 分)

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 (≤1000), 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<string>
#include<vector> using namespace std; bool judge(string& str)
{
bool flag = false; for(int i=;i<str.size();++i)
{
switch(str[i])
{
case '': str[i] = '@';flag = true;break;
case '': str[i] = '%';flag = true;break;
case 'l': str[i] = 'L';flag = true;break;
case 'O': str[i] = 'o';flag = true;break;
}
} return flag;
} int main()
{
int N;
string str1,str2;
vector<string> v; cin>>N; for(int i=;i<N;++i)
{
cin>>str1>>str2; if(judge(str2))
{
v.push_back(str1);
v.push_back(str2);
}
} if(v.size() == && N == )
cout<<"There is 1 account and no account is modified"<<endl;
else if(v.size() == && N > )
cout<<"There are " << N <<" accounts and no account is modified"<<endl;
else
{
cout<<v.size()/<<endl; for(int i=;i<v.size();i+=)
cout<<v[i]<<" "<<v[i+]<<endl;
}
}

PAT 甲级 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 1035 Password (20 分)

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

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

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

  5. PAT 甲级 1077 Kuchiguse (20 分)(简单,找最大相同后缀)

    1077 Kuchiguse (20 分)   The Japanese language is notorious for its sentence ending particles. Person ...

  6. PAT 甲级 1061 Dating (20 分)(位置也要相同,题目看不懂)

    1061 Dating (20 分)   Sherlock Holmes received a note with some strange strings: Let's date! 3485djDk ...

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

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

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

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

  9. 【PAT】1035. Password (20)

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

随机推荐

  1. ubuntu下,python2.7安装mysqlldb驱动方法

    安装依赖: sudo apt-get install libmysqlclient-dev libmysqld-dev python-dev python-setuptools 安装MySQLdb p ...

  2. django websocket

    1.dwebsocket 2.等框架都是错误的 3.  django/channels 才是正确姿势 555 4. pip install -U channels 完成后,您应该添加channels到 ...

  3. JavaScript·DOM,BOM

    YI.DOM 1.创建DOM 2.删除DOM 3.文档碎片 文档碎片可以提高DOM操作性能(理论上) 文档碎片(类似于一个口袋,先将多个元素放在口袋里,放完之后,再将口袋放到最终要插入的元素中): d ...

  4. 博客 新址: https://pheromone.github.io/

    该博客暂时调整歇业,小店地址暂时搬迁至: https://pheromone.github.io/ 该博客只做旧文章的维护工作. 博客 新址:  https://pheromone.github.io ...

  5. React Native - 网页组件(WebView)的使用详解

    一.WebView组件介绍 使用 WebView 组件我们可以通过 url 来加载显示一个网页,也可以传入一段 html 代码来显示.下面对其主要属性和方法进行介绍.   1,属性介绍 source: ...

  6. Linux安装配置rabbitmq

    Step1:安装erlang 1)下载erlang wget http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el7.centos.x8 ...

  7. java中字符串"1999-10-01T00:00:00+08: 00" 转化为Date格式

    String oldStr = "1999-10-01T00:00:00+08: 00": SimpleDateFORMAT sdf = new SimpleDateFORMAT ...

  8. vue 动态循环出的多个select 不能重复选择相同的数据

    看图说话 HTML: JS:        1)  2) 3) 有更好的方法可以相互学习.

  9. 光照构建失败。Swarm启动失败

    这是别人(http://blog.csdn.net/z609932088/article/details/52368015)写的,亲试可用 如下图 百度许久,有大神指出是我在编译源码的的时候没有将其中 ...

  10. bzoj 4589 FWT

    #include<bits/stdc++.h> #define ll long long using namespace std; ; ; ; ; <<],b[<< ...