Palindrome Check
1.0s 256MA string is called a palindrome if it reads the same forwards and backwards.
Given a string of length \(n\), determine whether it is a palindrome.
Syntax Restrictions
This is a C++ character-array practice problem. Your source code is checked automatically during judging.
Only #include <iostream> is allowed. Although the input is a string, store it with a C-style character array, such as char s[500005].
You may not use string, basic_string, vector, or other STL containers. You also may not use other headers such as <string>, <vector>, or <bits/stdc++.h>.
A submission that breaks the restrictions is judged SR (Syntax Restriction), and the judge feedback lists where the violation is.
Input
The input consists of 2 lines.
The first line contains a positive integer \(n\) (\(1 \le n \le 5 \times 10^5\)).
The second line contains a string of length \(n\) consisting of lowercase letters.
Output
Output “Yes” if the input string is a palindrome; otherwise, output “No”.
Sample Input 1
4
abba
Sample Output 1
Yes
Sample Input 2
5
abcab
Sample Output 2
No
Log in to write and submit code. Creating an account is free.