Palindromize - MarisaOJ: Marisa Online Judge

Palindromize

Time limit: 1000 ms
Memory limit: 256 MB
Given a string $S$ consisting of lowercase letters, find the minimum number of characters that need to be added to $S$ to make it a palindrome. A palindrome is a string that reads the same forwards and backwards. ### Input - A single line containing the string $S$ consisting only of lowercase letters. ### Output - Output a single integer representing the number of characters that need to be added. ### Constraints - $1 \le |S| \le 1000$. ### Exampl Input: ``` abcbe ``` Output: ``` 2 ``` One way to add characters to satisfy the condition is: `eabcbae`