#C41. Palindromes List Checker
Palindromes List Checker
Palindromes List Checker
This problem requires you to determine whether each word in a list is a palindrome. A palindrome is a string that reads the same backward as forward. Given a list of words, output a corresponding list of boolean values (True
or False
) indicating if each word is a palindrome. Note that the comparison is case-sensitive. For example, racecar
is a palindrome whereas hello
is not.
Formula: A string \( s \) is a palindrome if \( s = s^R \), where \( s^R \) denotes the reverse of \( s \).
inputFormat
The input is read from standard input (stdin
) in the following format:
- The first line contains an integer n, representing the number of words.
- The following n lines each contain a single word.
outputFormat
Output a single line to standard output (stdout
) containing n boolean values (True
or False
) separated by a single space. The i-th boolean value should be True
if the i-th word is a palindrome, and False
otherwise. If n is 0, output an empty line.
4
racecar
hello
level
world
True False True False