首页 > 代码库 > Codeforces-Translation(水题)
Codeforces-Translation(水题)
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
题意:
给你两个字符串,让你判断其中一个逆序是不是等于另一个
思路:
水题, 模拟去做就好了
代码:
1 #include <bits/stdc++.h> 2 using namespace std; 3 int main() 4 { 5 string s , t; 6 while(cin >> s >> t) 7 { 8 reverse(t.begin() , t.end()); 9 printf("%s\n" , s == t ? "YES" : "NO");10 s.clear() , t.clear();11 }12 13 }
Codeforces-Translation(水题)