2016 Al-Baath University Training Camp Contest-1 B
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.
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).
For each test case print a single line: 'Yes' if the words are similar in Arabic and 'No' otherwise.
4
Ponabity bonabety
barbie barpee
abcabc apcap
abc apcd
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的更多相关文章
- 2016 Al-Baath University Training Camp Contest-1
2016 Al-Baath University Training Camp Contest-1 A题:http://codeforces.com/gym/101028/problem/A 题意:比赛 ...
- 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 ...
- 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 ...
- 2016 Al-Baath University Training Camp Contest-1 A
Description Tourist likes competitive programming and he has his own Codeforces account. He particip ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- C++Builder组件
1.TOpenDialog: Title属性:用于获取或设置对话框标题,如果么偶有给该属性赋值,则系统将使用默认值标题:“打开” .InitialDir属性:用于获取或设置文件对话框显示的初始目录.如 ...
- Python基础(1)python+Eclipse+pydev环境搭建
编辑器:Python 自带的 IDLE 简单快捷, 学习Python或者编写小型软件的时候.非常有用. 编辑器: Eclipse + pydev插件 1. Eclipse是写JAVA的 ...
- ofbiz进击 第六节。 --OFBiz配置之[widget.properties] 配置属性的分析
配置内容分析如下 # -- 定义上下文使用者 -- security.context =default # -- 定义密码限制长度最小值 -- password.length.min =5 # -- ...
- 每天一个java基础知识--static
内存总体一共分为了 4个部分(stack segment.heap segment.code segment.data segment) 当我们在程序中,申明一个局部变量的时候,此变量就存放在了 st ...
- hdu4918 Query on the subtree
树分治,设当前树的分治中心为x,其子树分治中心为y,则设father[y]=x,分治下去则可以得到一颗重心树,而且树的深度是logn. 询问操作(x,d),只需要查询重心树上x到重心树根节点上的节点的 ...
- requireJs和r.js压缩工具
上面release是执行命令 node r.js -o build.js 生成的,需要切换到目录require/tools下面,也就是 有r.js和build.js的目录,才能执行命令 代码目录如上: ...
- sql 表连接 join
inner join 和 join 的 区别 inner join 是内连接 ,查询出两边 都有的数据 join 是交叉 连接, 假设集合A={a, b},集合B={0, 1, 2},则两个集 ...
- 夺命雷公狗---linux之centos的安装
由于要玩node.js了,所以还是来复习下linux系统才行,所以夺命雷公狗分享两套安装linux的方法,这是centos的安装方法,,, 管理员默认帐号为:root,密码则是刚才您输入的那个...
- java 网络编程(二)----UDP基础级的示例
下面介绍UDP基础级的代码示例: 首先了解创建UDP传输的发送端的思路: 1.创建UDP的Socket服务.2.将要发送的数据封装到数据包中.3.通过UDP的socket服务将数据包发送出去.4.关闭 ...
- hadoop自带例子wordcount的具体运行步骤
1.在hadoop所在目录“usr/local”下创建一个文件夹input root@ubuntu:/usr/local# mkdir input 2.在文件夹input中创建两个文本文件file1. ...