A11646 | Login Verification
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
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<=1000$ ) — 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.
The second line contains a single integer $n$ ( $1<=n<=1000$ ) — 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.
输出格式
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).
Otherwise print «No» (without quotes).
输入输出样例
输入 #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.
In the third sample case the new login is similar with the second one.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted