Another logic of Chef and String

If the string length is 1 or 2 or all the characters are same then ans is YES else NO. Is there anything wrong with this logic ?

My solution CodeChef: Practical coding for everyone

what about

aba
baa

or abab and baba

if string length is even and alternate chars are same then also ans is YES.
ex : bcbcbcbc

What about string —> abab ?

Ok got it

Yeah thanks