fork download
  1. #!/bin/python3
  2.  
  3. import math
  4. import os
  5. import random
  6. import re
  7. import sys
  8. n = int(input())
  9. s = input()
  10. c=0
  11. for i in range(0,n-3):
  12. if(s[i]=='D' and s[i+1]=='U' and s[i+2]=='D' and s[i+3]=='U'):
  13. c=c+1
  14. print(c)
  15.  
  16. # your code goes here
Success #stdin #stdout 0.02s 12028KB
stdin
9
UDDDUDUUD
stdout
1