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.

Input

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.

Output

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).

Examples

Input
1_wat
2
2_wat
wat_1
Output
Yes
Input
000
3
00
ooA
oOo
Output
No
Input
_i_
3
__i_
_1_
I
Output
No
Input
La0
3
2a0
La1
1a0
Output
No
Input
abc
1
aBc
Output
No
Input
0Lil
2
LIL0
0Ril
Output
Yes

Note

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.

题意:

给你一个字符串str,和n个其他字符串x,

如果这n个字符串中有任意一个可以通过题目给的3种变换操作变成和str一样的字符串,就输出No,否则输出Yes。

思路:

把规则统一即可。

即把所有的字符串和str都执行以下操作。

,所有的大写字符变为小写字符。

所有的L,I,i,l,都变为1

所有的o,O,都变为0,

然后对于每一个字符串都直接比较和str是否相等,相等就是No即可。

注意细节被出错误即可。

见代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define rt return
#define dll(x) scanf("%I64d",&x)
#define xll(x) printf("%I64d\n",x)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) {ll ans = ; while (b) {if (b % )ans = ans * a % MOD; a = a * a % MOD; b /= ;} return ans;}
inline void getInt(int* p);
const int maxn = ;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/ int main()
{
//freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);
//freopen("D:\\common_text\\code_stream\\out.txt","w",stdout); string str;
gbtb;
cin >> str;
int n;
cin >> n;
int isok = ;
string temp;
int len = str.length();
rep(j, , len)
{
if (str[j] == 'O')
{
str[j] = '';
} else if (str[j] == 'o')
{
str[j] = '';
} else if (str[j] == 'l')
{
str[j] = '';
} else if (str[j] == 'L')
{
str[j] = '';
} else if (str[j] == 'i')
{
str[j] = '';
} else if (str[j] == 'I')
{
str[j] = '';
} else if (str[j] >= 'A' && str[j] <= 'Z')
{
str[j] += ('a' - 'A');
}
}
repd(i, , n)
{
cin >> temp;
int tlen = temp.length();
if (tlen == len)
{
rep(j, , tlen)
{
if (temp[j] == 'O')
{
temp[j] = '';
} else if (temp[j] == 'o')
{
temp[j] = '';
} else if (temp[j] == 'l')
{
temp[j] = '';
} else if (temp[j] == 'L')
{
temp[j] = '';
} else if (temp[j] == 'i')
{
temp[j] = '';
} else if (temp[j] == 'I')
{
temp[j] = '';
} else if (temp[j] >= 'A' && temp[j] <= 'Z')
{
temp[j] += ('a' - 'A');
}
}
if (temp == str)
{
isok = ;
}
}
} if (!isok)
{
cout << "Yes" << endl;
} else
{
cout << "No" << endl;
}
return ;
} inline void getInt(int* p) {
char ch;
do {
ch = getchar();
} while (ch == ' ' || ch == '\n');
if (ch == '-') {
*p = -(getchar() - '');
while ((ch = getchar()) >= '' && ch <= '') {
*p = *p * - ch + '';
}
}
else {
*p = ch - '';
while ((ch = getchar()) >= '' && ch <= '') {
*p = *p * + ch - '';
}
}
}

Login Verification CodeForces - 928A (实现)的更多相关文章

  1. asp.net mvc ClaimsIdentity 授权研究 (还是测试版 有bug)

      安装 Microsoft.Owin.Host.SystemWeb Identity.Core Microsoft.Owin.Security.Cookies 在是startup.cs做如下修改 p ...

  2. CQRS学习——集成ASP.NET Identity[其五]

    [其实和Cqrs没啥关系] 缘由 其实没啥原因,只是觉得以前写了不知多少遍的用户登录复用性太差,实现的功能也不多. 依赖的Nuget包 简单登陆 就简单登陆而言,只需要实现如下接口/抽象类: Stor ...

  3. Python基础-day01

    写在前面 先后接触过很多编程语言,最喜欢的就是C和Python,相比其他语言,C 是神器,优点太多了:个人而言,C 最重要的一点就是能够让你在敲代码的时候是以一个计算机科学家的角度去思考,而不是仅仅停 ...

  4. asp.net Identity 设置自定义登录

    添加Startup.Auth.cs public partial class Startup { // For more information on configuring authenticati ...

  5. SSM基于Token的登录认证

    1.什么是token token的意思是“令牌”,是服务端生成的一串字符串,作为客户端进行请求的一个标识. 当用户第一次登录后,服务器生成一个token并将此token返回给客户端,以后客户端只需带上 ...

  6. 某宝抢购taobaosnap开发与实现

    某宝抢购脚本 Taobaosnap Taobaosnap is a completely open tool, which is used to buy goods in seconds on Tao ...

  7. Codeforces Round #455 (Div. 2) A. Generate Login【贪心】

    A. Generate Login time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  8. 主机宝(zhujibao) /a/apps/zhujibao/manager/apps/config/config.php no-password Login Vulnerabilities Based On Default cookie Verification From Default File

    catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 主机宝管理程序使用了CodeIgniter框架,要想在CodeIgnit ...

  9. 【Codeforces Round #455 (Div. 2) A】Generate Login

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 枚举两个串的前缀长度就好. 组出来. 排序. 取字典序最小的那个. [代码] #include <bits/stdc++.h& ...

随机推荐

  1. django框架使用mysql步骤

    在创建好django项目的基础上来讲解使用orm框架 注意:首先在mysql中手动或者通过命令创建一个数据库,我先创建一个名为orm的数据库. 1:在项目文件夹中的settings.py文件中配置my ...

  2. RecyclerView实现一个页面有多种item,每个item有多个view,并且可以让任意item的任意view自定义监听,通过接口方法进行触发操作

    百度了很多贴子,看着大佬的博客,模仿尝试,最终都是以失败告终,api可能版本不一样, 毕竟博客大佬都是7~8前写的,日期新点的都是好几年前了,多次尝试,还是报出莫名其妙的错. 哎,忧伤. 翻阅各种资料 ...

  3. JVM平台上的响应式流(Reactive Streams)规范

    // Reactive Streams // 响应式流是一个倡议,用来为具有非阻塞后压的异步流处理提供一个标准.大家努力的目标集中在运行时环境(JVM和JavaScript)和网络协议上. 注:响应式 ...

  4. SLAM+语音机器人DIY系列:(三)感知与大脑——6.做一个能走路和对话的机器人

    摘要 在我的想象中机器人首先应该能自由的走来走去,然后应该能流利的与主人对话.朝着这个理想,我准备设计一个能自由行走,并且可以与人语音对话的机器人.实现的关键是让机器人能通过传感器感知周围环境,并通过 ...

  5. #3 Python面向对象(二)

    前言 上一节主要记录面向对象编程的思想以及Python类的简单创建,这节继续深入类中变量的相关知识,Here we go! Python中类的各种变量 1.1 类变量 类变量定义:在类中,在函数体(方 ...

  6. JS 数组、对象的深拷贝

    博客地址:https://ainyi.com/72 JavaScript 程序中,对于简单的数字.字符串可以通过 = 赋值拷贝 但是对于数组.对象.对象数组的拷贝,就有浅拷贝和深拷贝之分 浅拷贝就是当 ...

  7. WPF Geometry 添加Path数据

    当图片转svg,svg转Xaml后,根据数据加载显示图片 DrawingImage: <DrawingImage x:Key="Image.Search"> <D ...

  8. MVC 中 Razor引擎学习:RenderBody,RenderPage和RenderSection

    RenderBody 在Razor引擎中没有了“母版页”,取而代之的是叫做“布局”的页面(_Layout.cshtml)放在了共享视图文件夹中.在这个页面中,会看到 标签里有这样一条语句: @Rend ...

  9. C# 读取PDF多级书签

    在PDF中,书签作为一种导航的有效工具,能帮助我们快速地定位到文档中的指定段落.同时,书签也能让人对文档结构一目了然,在某种程度上也可作为目录使用.对于C#操作PDF中的书签,在上一篇文章中介绍了具体 ...

  10. 了解AJAX

    1.如何打开终端的快捷键 Window+R==>CMD==>ipconfig 动态页面:跟后台发生数据交互的页面. 前后台数据交互依赖的一项技术叫 ajax. 1. js的异步操作 (1) ...