Python Programming Challenges for beginners?

n00m n00m at narod.ru
Fri Nov 27 01:19:57 EST 2009


On Nov 27, 5:24 am, astral orange <457r0... at gmail.com> wrote:
[skip]

How about the next problem:
you are given string "s" (len(s) <= ~10000), in the string only
letters 'a'..'z'
Task: to count the number of all *different* substrings of "s"

Example:
s = 'abbaz'
Its different substrings are:
a
b
z
ab
bb
ba
az
abb
bba
baz
abbaz
==================
Answer: 11



More information about the Python-list mailing list