You are viewing a single comment's thread. Return to all comments →
Here's a really simple solution for Python3:
def substrCount(n, s): count = n for x in range(n): y = x while y < n - 1: y += 1 if s[x] == s[y]: count += 1 else: if s[x:y] == s[y+1:2*y-x+1]: count += 1 break return count
Seems like cookies are disabled on this browser, please enable them to open this website
Special String Again
You are viewing a single comment's thread. Return to all comments →
Here's a really simple solution for Python3: