A - Translation
Problem description
The translation from the Berland language into the Birland language is not an easy task. Those languages are very similar: a berlandish word differs from a birlandish word with the same meaning a little: it is spelled (and pronounced) reversely. For example, a Berlandish word code corresponds to a Birlandish word edoc. However, it's easy to make a mistake during the «translation». Vasya translated word s from Berlandish into Birlandish as t. Help him: find out if he translated the word correctly.
Input
The first line contains word s, the second line contains word t. The words consist of lowercase Latin letters. The input data do not consist unnecessary spaces. The words are not empty and their lengths do not exceed 100 symbols.
Output
If the word t is a word s, written reversely, print YES, otherwise print NO.
Examples
Input
code
edoc
Output
YES
Input
abb
aba
Output
NO
Input
code
code
Output
NO
解题思路:检查第一个字符串反转之后是否和第二个字符串相等,是为"YES",否则为"NO"。
AC代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
string s,t;
cin>>s>>t;
reverse(s.begin(),s.end());
if(t==s)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return ;
}
最新文章
- 队列送券的实际应用--ConcurrentLinkedQueue并发队列
- Unity全屏模糊
- linux cpu性能测试
- iOS平台网络类型检测
- HDU 3951 (博弈) Coin Game
- linux file命令小记
- 二叉搜索树算法详解与Java实现
- SqlServer取得一个月的所有有日期
- 跨浏览器resize事件分析
- Unity3d 物体沿着正七边形轨迹移动
- [刷题]算法竞赛入门经典(第2版) 4-9/UVa1591 - Data Mining
- 【Azkaban搭建】---Azkaban 3.25.0搭建细则 超实用
- 【Python实践-2】求一个或多个数的乘积
- Eclipse工具常用快捷键
- Java 208 道面试题:第一模块答案
- Jenkins安装及基本配置(Linux版,使用web容器 tomcat 搭建)
- sublime text 3搭建python
- Fragment传参
- 量化交易(Quantitative Trading)
- ELK Deployed