#C9135. Palindrome After Removal
Palindrome After Removal
Palindrome After Removal
Given a string \(S\) of lowercase alphabets and a character \(C\), remove all occurrences of \(C\) from \(S\), and determine whether the resulting string is a palindrome. A string is considered a palindrome if it reads the same forwards and backwards. Note that an empty string is also regarded as a palindrome.
Formally, let \(S' = S \setminus \{C\}\). Output 1
if \(S'\) is a palindrome, otherwise output 0
.
inputFormat
The input is given via standard input and consists of two lines:
- The first line contains the string \(S\) which contains only lowercase letters.
- The second line contains a single character \(C\>.
outputFormat
Print 1
if the resulting string after removing all occurrences of \(C\) is a palindrome; otherwise, print 0
.
abccba
c
1