fork download
  1. from collections import Counter
  2. accumulator = Counter()
  3. text = 'hello world this is hello world.'
  4. for length in range(1,len(text)+1):
  5. for start in range(len(text) - length):
  6. accumulator[text[start:start+length]] += 1
  7.  
  8.  
  9. print(accumulator.most_common())
  10.  
Success #stdin #stdout 0.15s 10224KB
stdin
Standard input is empty
stdout
[('l', 6), (' ', 5), ('o', 4), ('h', 3), ('ello wor', 2), ('llo world', 2), ('lo w', 2), ('llo', 2), (' w', 2), ('ello ', 2), ('ello wo', 2), ('llo wor', 2), ('o w', 2), ('lo worl', 2), ('lo world', 2), ('worl', 2), ('s ', 2), ('hell', 2), ('ld', 2), ('lo', 2), ('ll', 2), (' wo', 2), ('el', 2), ('llo worl', 2), ('rl', 2), ('is ', 2), ('rld', 2), ('lo wor', 2), ('orl', 2), ('w', 2), ('hello w', 2), ('hello wo', 2), ('ello worl', 2), ('o worl', 2), ('r', 2), ('ello world', 2), (' wor', 2), ('llo ', 2), ('ello w', 2), ('o world', 2), (' world', 2), ('wor', 2), ('wo', 2), ('s', 2), ('hello world', 2), ('lo wo', 2), ('is', 2), ('hello wor', 2), ('ello', 2), ('o wor', 2), ('hello ', 2), ('hello worl', 2), ('llo wo', 2), ('i', 2), (' worl', 2), ('ell', 2), ('world', 2), ('d', 2), ('o ', 2), ('orld', 2), ('or', 2), ('hel', 2), ('he', 2), ('lo ', 2), ('llo w', 2), ('e', 2), ('o wo', 2), ('hello', 2), ('s is hell', 1), ('world this is hello worl', 1), ('this is hel', 1), (' h', 1), (' i', 1), ('s is hello wor', 1), (' t', 1), (' world this is hello w', 1), ('ello world this is hello world', 1), ('th', 1), ('d this is hello world', 1), ('d this is h', 1), (' hello wor', 1), ('orld this is h', 1), ('rld t', 1), ('s hello worl', 1), ('o world this is he', 1), ('ello world this ', 1), ('llo world thi', 1), ('orld ', 1), (' this is hello ', 1), (' is hel', 1), ('llo world this is hello ', 1), (' this ', 1), ('rld this is hello', 1), ('this is hello wo', 1), (' world this is hello wor', 1), ('o world this is ', 1), ('ello world this is hello ', 1), ('is hello ', 1), ('s is he', 1), ('rld this is h', 1), ('llo world this is hel', 1), ('hello world this is hello ', 1), ('his is hello wor', 1), ('ld this is hello w', 1), ('his is hello wo', 1), (' this is hel', 1), ('world this is hell', 1), ('this is he', 1), ('his is hell', 1), ('ld this is h', 1), ('ello world this is hello wo', 1), (' hel', 1), (' is hello wor', 1), ('is hell', 1), ('his is', 1), ('o world this is', 1), ('llo world this is hello w', 1), ('hello world thi', 1), ('hello world this is hello wo', 1), ('hello world this is hell', 1), ('ello world this i', 1), ('hello world th', 1), ('ld this is hell', 1), ('world this is hello ', 1), (' world this is hello worl', 1), ('is is h', 1), ('is hello wor', 1), ('is is hello', 1), ('is is hell', 1), (' world this is hello', 1), ('hello world this is hello wor', 1), ('rld this is hello worl', 1), (' is h', 1), ('this', 1), ('ello world this is hello worl', 1), ('rld this ', 1), ('this is', 1), ('orld th', 1), (' world t', 1), ('orld this is', 1), ('hello world this is hello w', 1), (' this is hello worl', 1), ('his', 1), (' world this is hello wo', 1), ('d th', 1), ('is hello w', 1), ('world this is ', 1), (' is hello', 1), ('o world this is hello world', 1), ('is is he', 1), ('llo world ', 1), (' world th', 1), ('ld this is hello wor', 1), ('lo world this is ', 1), (' hello ', 1), ('s is hello worl', 1), ('ld this is hello worl', 1), (' this is ', 1), ('lo world this is he', 1), (' world this is hello world', 1), ('rld this is hello ', 1), ('lo world this is hello ', 1), (' world this', 1), ('llo world this is hello worl', 1), ('this is hello w', 1), ('ello world ', 1), ('orld this is hel', 1), ('llo world this is hello wor', 1), ('lo world this ', 1), ('world ', 1), (' world this is hello ', 1), ('o world th', 1), ('his is hello world', 1), ('s hello ', 1), ('ello world this is hello w', 1), ('d this', 1), ('d this is hello wor', 1), (' this is hell', 1), ('is is hello world', 1), (' he', 1), ('o world this i', 1), ('his is he', 1), ('ello world this is', 1), (' is hello world', 1), ('s hello', 1), ('o world this is hello worl', 1), ('is he', 1), ('d thi', 1), ('ello world this is hell', 1), ('o world this', 1), ('hello world this is ', 1), ('ld t', 1), ('hello world this is he', 1), ('d this is hello w', 1), ('orld this', 1), (' this is h', 1), ('is is hel', 1), ('s is hello world', 1), ('orld this is he', 1), ('d this ', 1), ('llo world t', 1), (' this i', 1), ('o world this is hello wo', 1), ('s hello wor', 1), ('o world this is hello ', 1), ('d this is hello', 1), ('o world this ', 1), ('this is hello world', 1), ('o world this is hello wor', 1), ('this is hello wor', 1), ('hello world t', 1), ('s is hello ', 1), ('s is ', 1), ('world this i', 1), ('ello world t', 1), ('is hel', 1), ('ello world this is hel', 1), (' hell', 1), ('lo world this is hel', 1), ('hello world this is hel', 1), ('llo world this is ', 1), ('this is ', 1), ('llo world th', 1), ('hello world this ', 1), ('o world this is h', 1), ('ello world this is he', 1), ('o world thi', 1), ('llo world this i', 1), ('lo world this is hell', 1), ('lo world this is hello wo', 1), (' world this is hel', 1), (' this is', 1), (' this is hello world', 1), ('his is h', 1), ('world this is hello', 1), ('rld this is hell', 1), ('ello world th', 1), ('world this is hello wor', 1), ('orld this is hell', 1), (' hello worl', 1), ('world this is hel', 1), ('world t', 1), ('s is', 1), ('llo world this', 1), ('ld this is hello', 1), ('d t', 1), ('d ', 1), ('hello world ', 1), ('d this i', 1), ('orld t', 1), ('s is hello w', 1), (' this is hello w', 1), ('world this is h', 1), (' is', 1), (' world thi', 1), (' is he', 1), ('lo world t', 1), ('ld this is hello world', 1), ('d this is hello worl', 1), ('world this is hello world', 1), (' world this is', 1), ('world this is he', 1), (' world ', 1), ('orld this i', 1), (' world this ', 1), ('s hello world', 1), ('s is hello wo', 1), ('s hel', 1), ('is is ', 1), (' this', 1), (' thi', 1), ('ld this is hello ', 1), ('his is ', 1), ('rld this', 1), ('orld thi', 1), ('d this is ', 1), (' is hello ', 1), ('ello world thi', 1), ('llo world this is hello wo', 1), ('orld this is hello ', 1), ('s hello wo', 1), ('o world ', 1), ('d this is hello ', 1), ('his ', 1), (' world this is ', 1), ('d this is', 1), ('d this is he', 1), ('is is hello wo', 1), ('s h', 1), ('s i', 1), ('orld this is hello wor', 1), ('rld this is hello world', 1), ('world thi', 1), ('llo world this is hello world', 1), ('llo world this ', 1), ('llo world this is', 1), ('ld thi', 1), ('ld this is', 1), ('lo world this is hello world', 1), ('ld this is hello wo', 1), ('is hello wo', 1), ('lo world this', 1), ('rld this is', 1), (' is hell', 1), (' th', 1), ('orld this is hello worl', 1), ('ld th', 1), (' this is he', 1), ('llo world this is h', 1), ('is is', 1), ('his is hello worl', 1), ('world this is hello w', 1), ('rld this is ', 1), ('is hello', 1), ('llo world this is hello', 1), ('hello world this is hello', 1), ('hello world this is', 1), (' is hello worl', 1), ('s he', 1), (' hello world', 1), ('o world this is hello', 1), ('o world t', 1), ('world this ', 1), ('rld this is he', 1), ('world th', 1), ('hello world this is hello world', 1), ('ld this is hel', 1), ('this is hello worl', 1), ('rld thi', 1), ('is hello world', 1), ('is is hello ', 1), ('thi', 1), ('hello world this i', 1), ('ello world this is hello', 1), (' is hello wo', 1), ('ld this i', 1), ('world this is', 1), ('is is hello worl', 1), ('lo world this is hello worl', 1), ('rld this is hello wo', 1), (' world this is he', 1), (' is hello w', 1), ('orld this is ', 1), ('ld ', 1), ('is h', 1), ('is i', 1), ('lo world this is h', 1), ('hello world this is h', 1), (' is ', 1), ('o world this is hello w', 1), ('t', 1), ('d this is hell', 1), ('d this is hel', 1), ('is hello worl', 1), ('hello world this is hello worl', 1), ('orld this is hello wo', 1), ('ello world this is h', 1), ('this is h', 1), (' hello', 1), ('ld this is ', 1), ('ello world this is hello wor', 1), ('s is hel', 1), ('ld this', 1), ('world this is hello wo', 1), ('his i', 1), ('lo world th', 1), ('ello world this', 1), (' world this is h', 1), ('lo world this is hello w', 1), ('orld this is hello world', 1), ('hello world this', 1), ('rld this is hello wor', 1), ('his is hello w', 1), ('rld ', 1), ('s is hello', 1), ('s is h', 1), ('ld this is he', 1), (' this is hello wo', 1), ('is is hello wor', 1), ('ld this ', 1), ('rld this i', 1), ('s hello w', 1), ('rld this is hel', 1), (' this is hello wor', 1), ('this i', 1), ('s hell', 1), ('hi', 1), ('o world this is hell', 1), (' world this i', 1), ('this ', 1), ('orld this ', 1), ('o world this is hel', 1), ('llo world this is he', 1), ('his is hello ', 1), ('is is hello w', 1), ('llo world this is hell', 1), ('lo world this is', 1), ('rld this is hello w', 1), ('this is hello', 1), ('orld this is hello', 1), ('ello world this is ', 1), ('orld this is hello w', 1), ('lo world ', 1), ('this is hello ', 1), (' hello wo', 1), ('rld th', 1), ('lo world this is hello', 1), (' hello w', 1), ('d this is hello wo', 1), (' this is hello', 1), ('this is hell', 1), ('lo world this i', 1), ('lo world thi', 1), ('his is hello', 1), (' world this is hell', 1), ('world this', 1), ('his is hel', 1), ('lo world this is hello wor', 1)]