A string is defined as a "special sequence" if it can be partitioned into two non-empty contiguous substrings, s1 and s2, where both substrings satisfy a special palindromic property.
The property is as follows: a string is considered valid if, after removing at most one character from it, the resulting string can be rearranged to form a palindrome.
A string can be rearranged to form a palindrome if it has at most one character with an odd frequency. This means the original substring (before character removal) must have at most two characters with odd frequencies.
Your task is to determine if a given string S is a special sequence. If it is, return "Yes"; otherwise, return "No".
Input Format:
The first and only line of input contains a single string S.
Output Format:
Print a single string, either "Yes" or "No".
Note:
The string S must be split into two non-empty substrings. For a string of length n, there are n-1 possible split points.
A naive approach of re-calculating character frequencies for both substrings at every split point will be too slow (O(N²)).