Problem: There are N squares arranged in a row, numbered 1, 2, ..., N from left to right. You are given a string S of length N consisting of `.` and `#`. If the i-th character of S is `#`, Square i contains a rock; if the i-th character of S is `.`, Square i is empty.  In the beginning, Snuke stands on Square A, and Fnuke stands on Square B.  You can repeat the following operation any number of times:    * Choose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.  You want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.  Determine whether this is possible.

Submission attempts (in order):
li = list(input())
count = 0

counta = 0
i = 0
while(i<len(li)-1):
  if(li[i]=='A'):
    counta += 1
    if(li[i+1]=='B' and li[i+2]=='C'):
      count += counta
      li[i]='B'
      li[i+1]='C'
      li[i+2]='A'
      i = i+2
  else:
    counta = 0
    i = i+1

print(count)

n, a, b, c, d = map(int, input().split())
li = list(input())

count_dot = 0
count_sharp = 0
max_dot = 0

if(c>d):
  for i in range(a-1,d):
    if li[i]=='.':
      count_sharp = 0
      if b-2 <= i and i <= d:
        count_dot += 1
    else:
      max_dot = max(max_dot, count_dot)
      count_dot = 0
      count_sharp += 1
      if count_sharp>1:
        break
  max_dot = max(max_dot, count_dot)

  if(count_sharp<=1 and max_dot>2):
    print('Yes')
  else:
    print('No')
  print(count_sharp,max_dot)
else:
  for i in range(a-1,d):
    if li[i]=='#':
      if not c<b:
        count_sharp += 1
        if count_sharp>1:
          break
    else:
      count_sharp = 0
  if(count_sharp<=1):
    print('Yes')
  else:
    print('No')
  print(count_sharp)

n, a, b, c, d = map(int, input().split())
li = list(input())

count_dot = 0
count_sharp = 0
max_dot = 0

if(c>d):
  for i in range(n):
    if li[i]=='.':
      count_sharp = 0
      count_dot += 1
    else:
      max_dot = max(max_dot, count_dot)
      count_dot = 0
      count_sharp += 1
      if count_sharp>1:
        break
  max_dot = max(max_dot, count_dot)

  if(count_sharp<=1 and max_dot>2):
    print('Yes')
  else:
    print('No')
else:
  for i in range(n):
    if li[i]=='#':
      count_sharp += 1
      if count_sharp>1:
        break
    else:
      count_shrap = 0
  if(count_sharp<=1):
    print('Yes')
  else:
    print('No')

n, a, b, c, d = map(int, input().split())
li = list(input())

count_dot = 0
count_sharp = 0
max_dot = 0

if(c>d):
  for i in range(a-1,c):
    if li[i]=='.':
      count_sharp = 0
      if b-2 <= i and i <= d:
        count_dot += 1
    else:
      max_dot = max(max_dot, count_dot)
      count_dot = 0
      count_sharp += 1
      if count_sharp>1:
        break
  max_dot = max(max_dot, count_dot)

  if(count_sharp<=1 and max_dot>2):
    print('Yes')
  else:
    print('No')
  # print(count_sharp,max_dot)
else:
  for i in range(a-1,d):
    if li[i]=='#':
      if not c<b:
        count_sharp += 1
        if count_sharp>1:
          break
    else:
      count_sharp = 0
  if(count_sharp<=1):
    print('Yes')
  else:
    print('No')
  # print(count_sharp)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted