#K13891. Palindrome Partitioning Check
Palindrome Partitioning Check
Palindrome Partitioning Check
You are given a string s consisting of lowercase English letters. Your task is to perform two operations:
- Determine if s is a palindrome. A string is a palindrome if it reads the same backward as forward.
- Calculate the minimum number of contiguous substrings into which s can be partitioned such that each substring is a palindrome. For this problem, if the entire string is a palindrome then the answer is
1
; otherwise, output the length of s.
Note: The output should consist of two lines. The first line is either True
or False
indicating whether s is a palindrome. The second line is an integer representing the computed partition count.
inputFormat
The input is provided from standard input (stdin) as a single line containing the string s. The string consists of lowercase English letters without spaces.
outputFormat
The output should be printed to standard output (stdout) in two lines:
- The first line should be either
True
orFalse
indicating whether the given string is a palindrome. - The second line should be an integer representing the minimum number of contiguous palindromic substrings into which s can be partitioned. If s is a palindrome, output
1
; otherwise, output the length of s.
aba
True
1
</p>