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.

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;
}

  

转载于:https://www.cnblogs.com/yinghualuowu/p/6040707.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值