#C3072. Three Palindromic Partition
Three Palindromic Partition
Three Palindromic Partition
You are given a non-empty string s
. Your task is to determine if it is possible to partition s
into exactly three contiguous and non-empty parts, such that each part is a palindrome.
A palindrome is a string that reads the same backward and forward. For example, "aba" is a palindrome but "abc" is not.
If such a partition exists, print YES
; otherwise, print NO
.
inputFormat
The input consists of a single line containing the string s
.
outputFormat
Output a single line containing YES
if the string can be partitioned into three palindromic parts, or NO
otherwise.
abcbdd
YES