Codeforces Beta Round #40 (Div. 2) A题

来源:互联网 发布:干支纪日法简便算法 编辑:程序博客网 时间:2024/06/07 05:14

这道题目看样例就知道题意了!

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char a[105],b[105];
int main()
{
    int len1,len2,i,j;
    gets(a);
    gets(b);
    len1=strlen(a);
    len2=strlen(b);
    if(len1!=len2)
    {
        printf("NO\n");
        return 0;
    }
    for(i=0,j=len2-1; i<len1,j>=0; i++,j--)
    {
        if(a[i]!=b[j])
        {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    return 0;
}

原创粉丝点击