Why does every 3-string, composed of two letters have exactly 3 palindromic substrings?
for example: aab has a, b and aa aba has a,b and aba
I have been doing some practice questions for an upcoming Maths Challenge. There's one question I can't seem to grasp. I'm not sure entirely sure where to start. I don't know how to approach this one.. any help would be appreciated
There are only $2^3=8$ cases to check. The question also implies distinct palindromes, otherwise there would be more than $3$ of them in some strings: $$aaa\to a,aa,aaa$$ $$aab\to a,aa,b$$ $$aba\to a,b,aba$$ $$abb\to a,b,bb$$ $$baa\to b,a,aa$$ $$bab\to a,b,bab$$ $$bba\to b,bb,a$$ $$bbb\to b,bb,bbb$$