@scisaif Actually your logic is correct. You are thinking in right way. Its just you missed one interesting point (I too got it later. Was making same mistake). If the frequency of number is greater than 2 (for even) and greater than 3(for odd). Than you can fit one count characters in it.
For eg.) S = “aaaabbbbbcde”
Substrings = ‘aca’, ‘ada’, ‘bbb’, ‘beb’
So, logic is to divide all even count by 2 and all (odd-3 (as you need 3 minimum characters for palindrome)) by 2. Total sum should be greater than 1 frequency character.
Just think here let’s say you have k once occuring characters then you need all of them to be handles by those which occur more than once so just count how much once occuring characters can be handled by others for example “aabbbbcfgdeeeee” can be written as acabfbbgbedeeee hence a handles 1 , b handles 2 and e handles 1 so we can make string palpal