CF928A.Login Verification
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
Login is an arbitrary sequence of lower and uppercase latin letters, digits and underline symbols («_»). However, in order to decrease the number of frauds and user-inattention related issues, it is prohibited to register a login if it is similar with an already existing login. More precisely, two logins s and t are considered similar if we can transform s to t via a sequence of operations of the following types:
- transform lowercase letters to uppercase and vice versa;
- change letter «O» (uppercase latin letter) to digit «0» and vice versa;
- change digit «1» (one) to any letter among «l» (lowercase latin «L»), «I» (uppercase latin «i») and vice versa, or change one of these letters to other.
For example, logins «Codeforces» and «codef0rces» as well as «OO0OOO00O0OOO0O00OOO0OO_lol» and «OO0OOO0O00OOO0O00OO0OOO_1oI» are considered similar whereas «Codeforces» and «Code_forces» are not.
You're given a list of existing logins with no two similar amonst and a newly created user login. Check whether this new login is similar with any of the existing ones.
在社交网络注册时,用户可以创建自己方便的登录名,以便于分享联系人、印在名片上等。
登录名是由任意小写和大写拉丁字母、数字以及下划线符号(«_»)组成的序列。然而,为了减少欺诈行为及用户疏忽导致的问题,禁止注册与已有登录名相似的新登录名。更准确地说,两个登录名 s 和 t 被认为是相似的,当且仅当可以通过以下类型的操作序列将 s 变换为 t:
- 将小写字母转换为对应的大写字母,或将大写字母转换为对应的小写字母;
- 将字母 «O»(大写拉丁字母)与数字 «0»(零)相互转换;
- 将数字 «1»(一)与字母 «l»(小写拉丁字母 L)、«I»(大写拉丁字母 i)中的任意一个相互转换,或在这些字母之间相互转换。
例如,登录名 «Codeforces» 与 «codef0rces» 相似,«OO0OOO00O0OOO0O00OOO0OO_lol» 与 «OO0OOO0O00OOO0O00OO0OOO_1oI» 也相似;而 «Codeforces» 与 «Code_forces» 则不相似。
现给出一个无两两相似的已有登录名列表,以及一个新创建的用户登录名。请判断该新登录名是否与任一已有登录名相似。
输入格式
The first line contains a non-empty string s consisting of lower and uppercase latin letters, digits and underline symbols («_») with length not exceeding 50 — the login itself.
The second line contains a single integer n (1 ≤ n ≤ 1 000) — the number of existing logins.
The next n lines describe the existing logins, following the same constraints as the user login (refer to the first line of the input). It's guaranteed that no two existing logins are similar.
第一行包含一个非空字符串 s,由小写和大写拉丁字母、数字以及下划线符号(«_»)组成,长度不超过 50 —— 即用户登录名本身。
第二行包含一个整数 n(1 ≤ n ≤ 1 000)—— 现有登录名的数量。
接下来的 n 行描述现有的登录名,其约束条件与用户登录名相同(参见输入的第一行)。保证任意两个现有登录名互不相似。
输出格式
Print «Yes» (without quotes), if user can register via this login, i.e. none of the existing logins is similar with it.
Otherwise print «No» (without quotes).
如果用户可以通过该登录名注册(即:不存在与之相似的现有登录名),则输出 «Yes»(不带引号);
否则输出 «No»(不带引号)。
输入输出样例
输入#1
1_wat 2 2_wat wat_1
输出#1
Yes
输入#2
000 3 00 ooA oOo
输出#2
No
输入#3
_i_ 3 __i_ _1_ I
输出#3
No
输入#4
La0 3 2a0 La1 1a0
输出#4
No
输入#5
abc 1 aBc
输出#5
No
输入#6
0Lil 2 LIL0 0Ril
输出#6
Yes
说明/提示
In the second sample case the user wants to create a login consisting of three zeros. It's impossible due to collision with the third among the existing.
In the third sample case the new login is similar with the second one.
在第二个样例中,用户希望创建一个由三个零组成的登录名。但由于与已存在的第三个登录名发生冲突,这是不可能的。
在第三个样例中,新登录名与第二个已存在的登录名相似。
输入解题思路,AI测评打分。不知道怎么写?