fork(1) 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 ['8','9']:
  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.67s 78540KB
stdin
Standard input is empty
stdout
:::12345678910111213
--
    88 at 454     [518618718818919019]
    99 at 168     [586878889909192939]
   888 at 165     [8485868788899091929]
   999 at 2587    [6897898899900901902]
  8888 at 83330   [86188871888818889188]
  9999 at 34886   [99789988999900090019]
 88888 at 2553    [858868878888898908918]
 99999 at 438885  [978999889999900009000]
888888 none
999999 at 5288884  [7899998899999900000900]
8888888 at 34441   [88868887888888898890889]
9999999 none