25
[0, 0, "a", 1]
[1, 1, "b", 2]
[1, 2, "bb", 3]
[2, 2, "b", 4]
[1, 3, "bbb", 5]
[2, 3, "bb", 6]
[3, 3, "b", 7]
[1, 4, "bbbb", 8]
[2, 4, "bbb", 9]
[3, 4, "bb", 10]
[4, 4, "b", 11]
[1, 5, "bbbbb", 12]
[2, 5, "bbbb", 13]
[3, 5, "bbb", 14]
[4, 5, "bb", 15]
[5, 5, "b", 16]
[0, 6, "abbbbba", 17]
[6, 6, "a", 18]
[6, 7, "aa", 19]
[7, 7, "a", 20]
[6, 8, "aaa", 21]
[7, 8, "aa", 22]
[8, 8, "a", 23]
[5, 9, "baaab", 24]
[9, 9, "b", 25]
#Ruby22
s = "abbbbbaaab"
n = 0
for r in 0...s.size
for l in 0..r
t = s[l..r]
if t.reverse == t
n += 1
p [l,r,t,n]
end
end
end