You are viewing a single comment's thread. Return to all comments →
but, what about the string, aaabbb, it is a palindrome with a's odd and b's odd. can someone explane the approche.
aaabbb is not a palindrome, as aaabbb != bbbaaa. :)
Let me explain the approach a bit further.
Let's say we have a string abcxyz. If it's a palindrome, than a =z , b=y, c = x. So we have a string abccba. So we have a pair of each elements. Which means if the len of the string is even => there is at least one pair of each element hence the count of each element should be even. But if the len of the string is odd it means in the middle of the string there should be one and only one unpaired element. So, the count of ONLY one element should be odd.
thnkuuu ur explaination is really helpful... :)
Then why is my testcases failing here? Does the execution has problem?
Bro your question is wrong,its,aaabbbb
String "aaabbb" is not palindrome . in the sample test case string is "aaabbbb" .
s = input()
s = list(s)
liss = 26
for char in s:
total = sum(map(abs,liss))