Advertisement
Farz0l1x

Untitled

Apr 3rd, 2024
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.23 KB | None | 0 0
  1. file = open('26.txt')
  2. s = file.readline()
  3. x = 'DBAC'
  4. ans = 0
  5. while x in s:
  6.     ans = len(x)
  7.     x += 'DBAC'
  8. x = x[:-4]
  9. if x + 'D' in s:
  10.     ans += 1
  11. if x + 'DB' in s:
  12.     ans += 1
  13. if x + "DBA" in s:
  14.     ans += 1
  15. print(ans)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement