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. 【Origin】jquery.barddialog.js

    /// <reference path="jquery-2.1.1.min.js" /> /** * @license jquery.bardDialog 1.0.0 ...

  2. git的基本使用

    1.在本地新建一个文件夹来存放代码 2.用命令行进入这个文件夹 3.git init --来创建一个代码仓库 3. 配置用户信息:用户名和 邮箱(联系作者本人沟通, 责任到人) git config ...

  3. .NET: C#: System.Diagnostics

    1. Trace & Debug 理解这两者的区别,Trace有个Listners.Add()非常好用,这里网上有个在ListBox里输出Debug和Trace信息的 using System ...

  4. .net 反编译工具

    遇到一个需求,做一个专门访问自己网站的浏览器给用户使用,这个浏览器提供登录功能.此时是一个安装在客户端的exe程序,做登录验证要用到webservice,不能将验证逻辑写入exe中,否则客户端可以利用 ...

  5. HDU 1724 Ellipse(数值积分の辛普森公式)

    Problem Description Math is important!! Many students failed in 2+2’s mathematical test, so let's AC ...

  6. SIFT算法详解(转)

    http://blog.csdn.net/zddblog/article/details/7521424 目录(?)[-] 尺度不变特征变换匹配算法详解 Scale Invariant Feature ...

  7. 深入了解webservice_开发实战篇

    服务器端: 第一: 配置环境 创建一个Web Project,将XFire自己的包及其XFire依赖的jar包(6个jar包)全部导入到classpath下,方法是,只需将jar包粘贴在WebRoot ...

  8. zw版【转发·台湾nvp系列例程】halcon与delphi系列例程

    zw版[转发·台湾nvp系列例程]halcon与delphi系列例程 台湾nvp技术论坛,是目前halcon与delphi例程最多的网站,也是唯一成系列的, http://zip.nvp.com.tw ...

  9. 由Unicode编码想到弄懂编码表

    test unicode好 007400650073007400200075006E00690063006F00640065597D 这是一个Unicode编码,一共六七万的汉字,可以说Unicode ...

  10. B2C电子商务网站技术框架

    一 设计原则 电子商务平台总体结构的设计应从体系.功能.信息.过程等各个方面保证整个电子商务平台总体目标的实现,以提高市场竞争能力.总体结构的设计应考虑以下设计原则: 快速响应原则:商机稍纵即逝,网站 ...