题目大意
给一些密码,要求将密码中的1
(one)替换成@
,0
(zero)替换成%
,l
(L
in lowercase)替换成L
,O
(o
in uppercase)替换成o
输入
每组包含一个测试用例,每个用例的第一行是正整数 N ≤ 1000 N\leq 1000 N≤1000,接着有 N N N行,每一行是一个队伍的名字和密码,名字和密码的长度都不超过10
输出
对每个用例,先在一行中输出修改的密码数
M
M
M,之后每行输出修改的队伍名和密码。如果没有修改的且一共只有一支队伍,就输出There is 1 account and no account is modified
。如果没有修改的,但是队伍一共不止一支就输出There are N accounts and no account is modified
, N
是总队伍的数量
输入样例
3
Team000002 Rlsp0dfa
Team000003 perfectpwd
Team000001 R1spOdfa
1
team110 abcdefg332
2
team110 abcdefg222
team220 abcdefg333
输出样例
2
Team000002 RLsp%dfa
Team000001 R@spodfa
There is 1 account and no account is modified
There are 2 accounts and no account is modified
解析
字符替换就完事了
# -*- coding: utf-8 -*-
# @Time : 2019/5/31 16:27
# @Author : ValarMorghulis
# @File : 1035.py
def solve():
n = eval(input())
res = list()
for i in range(n):
team, pwd = input().split()
if '1' in pwd or '0' in pwd or 'l' in pwd or 'O' in pwd:
if '1' in pwd:
pwd=pwd.replace('1', '@')
if '0' in pwd:
pwd=pwd.replace('0', '%')
if 'l' in pwd:
pwd=pwd.replace('l', 'L')
if 'O' in pwd:
pwd=pwd.replace('O', 'o')
res.append(team + ' ' + pwd)
if len(res) == 0:
if n == 1:
print("There is 1 account and no account is modified")
else:
print("There are %d accounts and no account is modified" % n)
else:
print(len(res))
for i in res:
print(i)
if __name__ == "__main__":
solve()