Translation
题面翻译
题面描述
Berland 和 Birland 两地均有各自的语言,Berlandish 和 Birlandish。V 是一个翻译员,负责将 Berlandish 翻译成 Birlandish。将 Berlandish 翻译成 Birlandish 其实非常简单,只需把这个单词倒过来。比如单词code
翻译过来就是edoc
。但是粗心的 V 还是会犯一些错误。现在请你帮她判断一下他翻译的是否正确。
输入格式
两行,分别是一个 Berlandish 单词和 V 翻译的 Birlandish 单词。单词中所有字母均为小写拉丁字母(其实就是英文字母);单词长度均不超过 100 100 100 字符,单词中不包含任何多余空格。
输出格式
一行,如果 V 的翻译是正确的,输出YES
。否则输出NO
。
题目描述
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.
输入格式
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.
输出格式
If the word $ t $ is a word $ s $ , written reversely, print YES, otherwise print NO.
样例 #1
样例输入 #1
code
edoc
样例输出 #1
YES
样例 #2
样例输入 #2
abb
aba
样例输出 #2
NO
样例 #3
样例输入 #3
code
code
样例输出 #3
NO
代码内容
// #include <iostream>
// #include <algorithm>
// #include <cstring>
// #include <stack>//栈
// #include <deque>//队列
// #include <queue>//堆/优先队列
// #include <map>//映射
// #include <unordered_map>//哈希表
// #include <vector>//容器,存数组的数,表数组的长度
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
string x,y;
cin>>x>>y;
reverse(x.begin(),x.end());
if(x==y) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}