Description

A group of junior programmers are attending an advanced programming camp, where they learn very difficult algorithms and programming techniques! Near the center in which the camp is held, is a professional bakery which makes tasty pastries and pizza. It is called 'Bonabity'... or 'Ponapety'... or 'Ponabity'... Actually no one knows how to spell this name in English, even the bakery owner doesn't, and the legends say that Arabs always confuse between 'b' and 'p', and also between 'i' and 'e', so 'b' for them is just the same as 'p', and 'i' for them is just the same as 'e', they also don't care about letters' cases (uppercase and lowercase for a certain letter are similar). For example, the words 'Ponabity' and 'bonabety' are considered the same. You are given two words including only upper case and lower case English letters, and you have to determine whether the two words are similar in Arabic.

Input

The input consists of several test cases. The first line of the input contains a single integer T, the number of the test cases. Each of the following T lines represents a test case and contains two space-separated strings (each one consists of only upper case and lower case English letters and its length will not exceed 100 characters).

Output

For each test case print a single line: 'Yes' if the words are similar in Arabic and 'No' otherwise.

Example
input
4
Ponabity bonabety
barbie barpee
abcabc apcap
abc apcd
output
Yes
Yes
No
No
题意:不区分大小写,还有i和e,d和b一样,给我们字符串,判断是不是在这个条件下相同
解法:模拟
#include<bits/stdc++.h>
using namespace std;
string s1,s2,s3,s4;
int main()
{
int t;
cin>>t;
while(t--)
{
cin>>s1>>s2;
s3="";
s4="";
for(int i=0;i<s1.length();i++)
{
if(s1[i]=='p'||s1[i]=='P')
{
s3+='b';
}
else if(s1[i]=='i'||s1[i]=='I')
{
s3+='e';
}
else
{
s3+=tolower(s1[i]);
}
}
for(int i=0;i<s2.length();i++)
{
if(s2[i]=='p'||s2[i]=='P'||s2[i]=='b'||s2[i]=='B')
{
s4+='b';
}
else if(s2[i]=='i'||s2[i]=='I'||s2[i]=='E'||s2[i]=='e')
{
s4+='e';
}
else
{
s4+=tolower(s2[i]);
}
}
if(s3==s4)
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}
// cout<<s3<<endl;
}
return 0;
}

  

2016 Al-Baath University Training Camp Contest-1 B的更多相关文章

  1. 2016 Al-Baath University Training Camp Contest-1

    2016 Al-Baath University Training Camp Contest-1 A题:http://codeforces.com/gym/101028/problem/A 题意:比赛 ...

  2. 2014-2015 Petrozavodsk Winter Training Camp, Contest.58 (Makoto rng_58 Soejima contest)

    2014-2015 Petrozavodsk Winter Training Camp, Contest.58 (Makoto rng_58 Soejima contest) Problem A. M ...

  3. 2016 Al-Baath University Training Camp Contest-1 E

    Description ACM-SCPC-2017 is approaching every university is trying to do its best in order to be th ...

  4. 2016 Al-Baath University Training Camp Contest-1 A

    Description Tourist likes competitive programming and he has his own Codeforces account. He particip ...

  5. 2016 Al-Baath University Training Camp Contest-1 J

    Description X is fighting beasts in the forest, in order to have a better chance to survive he's gon ...

  6. 2016 Al-Baath University Training Camp Contest-1 I

    Description It is raining again! Youssef really forgot that there is a chance of rain in March, so h ...

  7. 2016 Al-Baath University Training Camp Contest-1 H

     Description You've possibly heard about 'The Endless River'. However, if not, we are introducing it ...

  8. 2016 Al-Baath University Training Camp Contest-1 G

    Description The forces of evil are about to disappear since our hero is now on top on the tower of e ...

  9. 2016 Al-Baath University Training Camp Contest-1 F

    Description Zaid has two words, a of length between 4 and 1000 and b of length 4 exactly. The word a ...

随机推荐

  1. SLF4简介

    The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logg ...

  2. 我与 美国作家 21天精通C++ 作者 Rao的对话:

    这就是动力呀!

  3. ACdream 1128 Maze(费用流)

    题目链接:http://acdream.info/problem?pid=1128 Problem Description wuyiqi陷入了一个迷宫中,这个迷宫是由N*M个格子组成的矩阵.每个格子上 ...

  4. 侧菜单栏的实现SlidingPaneLayout

    SlidingPaneLayout分为两部分,上面的 左划出部分和没划出的时候 <?xml version="1.0" encoding="utf-8"? ...

  5. radio应用

    1.获取选中值,三种方法都可以: $('input:radio:checked').val(): $("input[type='radio']:checked").val(); $ ...

  6. EBS R12中重新enable失效用户之后,丢失职责

    以下请求跑完不能立即生效,需要等上一段时间! oracle support说这并不是一个bug,是一个问题,呵呵,bug和问题,都是你的错,oracle! 工 作中将某个用户失效之后,有可能又需要重新 ...

  7. 夺命雷公狗---Thinkphp----11之管理员的增删改查的完善

    由于我们刚才的帐号还没通过任何的验证就可以直接进入数据库了,这当然不是不合理的交互逻辑,所以我们要修改下,让他变得3合理一些, 所以我们还是要按照套路来修改几处即可解决问题: 首先修改下添加的控制器: ...

  8. PAT乙级 1026. 程序运行时间(15)

    1026. 程序运行时间(15) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 要获得一个C语言程序的运行时间, ...

  9. 【php】目录、路径和文件 操作

    目录操作 解析路径: basename() - 返回路径的文件名部分 获取目录部分: dirname() - 返回路径的目录部分 路径信息: pathinfo() - 返回数组(目录名,基本名,扩展名 ...

  10. js中把JSON字符串转换成JSON对象最好的方法

    在JS中将JSON的字符串解析成JSON数据格式,一般有两种方式: 1.一种为使用eval()函数. 2. 使用Function对象来进行返回解析. 第一种解析方式:使用eval函数来解析,并且使用j ...