Ad Code

Responsive Advertisement

Toph | Is Palindrome | Beginner

 | Is Palindrome

Limits 1s, 512 MB

Given a word, print \texttt{Yes} if it is a palindrome, otherwise \texttt{No}.

A palindrome is a word which reads the same backward as forward, e.g. racecar.

Input

The input will contain a string S (0 < \texttt{Length of S} < 100).

S will contain lowercase alphabets only.

Output

Print \texttt{Yes} or \texttt{No}.

Samples

Input Output
racecar
Yes
Input Output
carrot
No

N.B.: It's better if you solve this by your own. Thank you!

  Toph Online Judge Is Palindrome Solve  in C :                                          

//Solved by Intesar
#include <stdio.h>
#include <string.h>

int main(){
    char string1[20];
    int i, length;
    int flag = 0;
    scanf("%s", string1);

    length = strlen(string1);
    for(i=0;i < length ;i++){
        if(string1[i] != string1[length-i-1]){
            flag = 1;
            break;
   }
}

    if (flag) {
        printf("No");
    }
    else {
        printf("Yes");
    }
    return 0;
}

Post a Comment

0 Comments

Ad Code

Responsive Advertisement