Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. def main():
  2. case_no = 0
  3. while True:
  4. try:
  5. string = input()
  6. except:
  7. exit()
  8.  
  9. if string == "\n":
  10. break
  11.  
  12. case_no = case_no + 1
  13. if case_no == 1:
  14. print("Case %d:" % case_no)
  15. else:
  16. print("\nCase %d:" % case_no)
  17.  
  18. n = int(input())
  19.  
  20. for it in range(n):
  21. i, j = input().split()
  22. i, j = int(i), int(j)
  23.  
  24. a = i if i <= j else j
  25. b = j if j > i else i
  26.  
  27. flag = True
  28. retorno = ''
  29. for x in range(a+1, b+1):
  30. if string[x] != string[x-1]:
  31. retorno = 'No'
  32. flag = False
  33. break
  34.  
  35. if flag:
  36. retorno = 'Yes'
  37.  
  38. print(retorno, end="" if it == n - 1 else "\n")
  39.  
  40. if __name__ == "__main__":
  41. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement