Translation

简介: Translation

文章目录

一、Translation

总结


一、Translation

本题链接:


题目:

A. Translation

time limit per test2 seconds

memory limit per test256 megabytes

inputstandard input

outputstandard output

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


本博客给出本题截图:

image.png

题意:输入两个字符串,如果一个字符串reverse一遍正好和另一个字符串一样的话,就输出YES,否则输出NO

AC代码1

#include <iostream>
#include <string>
using namespace std;
int main()
{
  string a, b;
  cin >> a >> b;
  bool flag = false;
  for (int i = 0, j = b.size() - 1; i < a.size(); i ++, j -- )
    if (a[i] != b[j])
    {
      flag = true;
      break;
    }
  if (flag) puts("NO");
  else puts("YES");
  return 0;
}

AC代码2

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
  string a, b;
  cin >> a >> b;
  reverse(a.begin(), a.end());
  if (a == b) puts("YES");
  else puts("NO");
  return 0;
}

总结

水题,不解释


目录
相关文章
什么是翻译领域的 Interpretative translation
什么是翻译领域的 Interpretative translation
|
5月前
|
安全
什么是翻译领域的 literal translation
什么是翻译领域的 literal translation
|
5月前
|
TensorFlow 算法框架/工具
[seq2seq]论文实现:Effective Approaches to Attention-based Neural Machine Translation(上)
[seq2seq]论文实现:Effective Approaches to Attention-based Neural Machine Translation(上)
42 1
|
5月前
|
机器学习/深度学习 Python TensorFlow
[seq2seq]论文实现:Effective Approaches to Attention-based Neural Machine Translation(下)
[seq2seq]论文实现:Effective Approaches to Attention-based Neural Machine Translation(下)
44 1
|
5月前
|
机器学习/深度学习 自然语言处理 算法
[BPE]论文实现:Neural Machine Translation of Rare Words with Subword Units
[BPE]论文实现:Neural Machine Translation of Rare Words with Subword Units
30 0
|
算法 PyTorch 算法框架/工具
论文解读:LaMa:Resolution-robust Large Mask Inpainting with Fourier Convolutions
论文解读:LaMa:Resolution-robust Large Mask Inpainting with Fourier Convolutions
619 0
|
机器学习/深度学习 存储 自然语言处理
PESE Event Structure Extraction using Pointer Network based Encoder-Decoder Architecture论文解读
事件抽取(EE)的任务旨在从文本中找到事件和事件相关的论元信息,并以结构化格式表示它们。大多数以前的工作都试图通过分别识别多个子结构并将它们聚合以获得完整的事件结构来解决这个问题。
75 0
|
机器学习/深度学习 编解码 文字识别
Hybrid Multiple Attention Network for Semantic Segmentation in Aerial Images(一)
Hybrid Multiple Attention Network for Semantic Segmentation in Aerial Images
146 0
Hybrid Multiple Attention Network for Semantic Segmentation in Aerial Images(一)
|
机器学习/深度学习 编解码 文字识别
Hybrid Multiple Attention Network for Semantic Segmentation in Aerial Images(二)
Hybrid Multiple Attention Network for Semantic Segmentation in Aerial Images
188 0
Hybrid Multiple Attention Network for Semantic Segmentation in Aerial Images(二)
|
搜索推荐 PyTorch 算法框架/工具
Re30:读论文 LegalGNN: Legal Information Enhanced Graph Neural Network for Recommendation
Re30:读论文 LegalGNN: Legal Information Enhanced Graph Neural Network for Recommendation
Re30:读论文 LegalGNN: Legal Information Enhanced Graph Neural Network for Recommendation