fork download
  1. import re
  2.  
  3. def f(x):
  4. return ''.join(str(c) for c in range(1,x+1))
  5. print(f":::{f(13)}")
  6.  
  7. def test(s):
  8. print("--")
  9. for x in range(2,8):
  10. for c in ['2','3']:
  11. for z in re.finditer(rf"[^{c}][{c}]{{{x}}}[^{c}]",s):
  12. n=z.start()+1
  13. print(f"{c*x:>6s} at {n:<6} [{s[n-8:n+8+x]}]")
  14. break
  15. else:
  16. print(f"{c*x:>6s} none")
  17.  
  18. test(f(1000000))
Success #stdin #stdout 0.57s 78528KB
stdin
Standard input is empty
stdout
:::12345678910111213
--
    22 at 256     [912012112212312412]
    33 at 289     [013113213313413513]
   222 at 33      [1819202122232425262]
   333 at 55      [2930313233343536373]
  2222 at 50000   [20122211222212223122]
  3333 at 55555   [31133321333313334133]
 22222 at 555     [192202212222232242252]
 33333 at 888     [303313323333343353363]
222222 none
333333 none
2222222 at 7777    [22202221222222232224222]
3333333 at 12221   [33313332333333343335333]