-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathPalindromic String.cpp
More file actions
49 lines (43 loc) · 873 Bytes
/
Palindromic String.cpp
File metadata and controls
49 lines (43 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
/*
You have been given a String
S
S. You need to find and print whether this string is a palindrome or not. If yes, print "YES" (without quotes), else print "NO" (without quotes).
Input Format
The first and only line of input contains the String
S
S. The String shall consist of lowercase English alphabets only.
Output Format
Print the required answer on a single line.
Constraints
1
≤
|
S
|
≤
100
1≤|S|≤100
Note
String
S
S consists of lowercase English Alphabets only.
SAMPLE INPUT
aba
SAMPLE OUTPUT
YES
URL: https://www.hackerearth.com/practice/basic-programming/input-output/basics-of-input-output/practice-problems/algorithm/palindrome-check-2/
*/
using namespace std;
int main()
{
string s;
cin>>s;
if(s == string(s.rbegin(),s.rend()))
{
cout<<"YES";
}
else
cout<<"NO";
return 0;
}