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 ...
随机推荐
- [转]怎样解决Myeclipse内存溢出?
在用myeclipes10 开发 遇到了 内存溢出问题,百度了很久,这篇比较完善. 总结起来三个方面去检查 1)myeclipes的配置:myeclipes 10 的安装路径下 的myeclipse. ...
- Could not create the view: An unexpected exception was thrown.如何解决
今天打开Myeclipse10的时候,发现server窗口出现一堆问题,问题如标题,然后下方出现了一堆java.lang.NullPointerException的问题. java.lang.Null ...
- php 随机生成
php随机生成6位字符串: $str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'; $max = ...
- MySQL 请选择合适的列! 转载(http://www.cnblogs.com/baochuan/archive/2012/05/23/2513224.html)
点击图片,可查看大图. 介绍 情况:如果你的表结构设计不良或你的索引设计不佳,那么请你优化你的表结构设计和给予合适的索引,这样你的查询性能就能提高几个数量级.——数据越大,索引的价值越能体现 ...
- Android中实现app版本更新
1,获取本地程序apk版本,并开启服务(下面这段代码一般在主Activity中的onCreate()方法中执行的,并开启后台服务下载新版本的apk) //获取apk包文件的管理者对象 PackageM ...
- android fragment+ FragmentTabHost+viewpager 切换状态不保存的问题
转载请注明出处:http://blog.csdn.net/djy1992/article/details/46674169 @author dujinyang 难得有时间上来写博客. fragment ...
- sql 中实现打乱数据的排序
sql 中实现打乱数据的排序 order by NEWID()就实现了数据的打乱
- 仅支持webkit浏览器的多行内容超出显示省略号
.box { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; ...
- 操作系统,windows编程,网络,socket
首发:个人博客,更新&纠错&回复 之前关于c/s的一篇博文只记了思路没记代码,而且表达不清晰,事后看不知所云,这个习惯要改. 这十几天学了点关于操作系统.windows编程和网络,主要 ...
- UIViewController卸载过程(ios6.0以后)
在ios6.0以后,废除了viewWillUnload方法和viewDidUnload方法. 在ios6以后,当收到didReceiveMemoryWarning消息调用之后,程序会自动调用didRe ...