My issue
T = map(int, input().split())
N = map(int, input().split())
l =
count = 0
for i in range(N):
if(l[i] == ‘X’ and l[i+1] == ‘Y’):
count == count + 1
print(count)
elif(l[i] == ‘X’ and l[i+1] == ‘Y’):
count == count + 1
print(count)
elif(l[i] == ‘X’ and l[i+1] == ‘X’):
count = count
print(count)
else:
count = count
print(count)
whats the problem here?
My code
# cook your dish here
T = map(int, input().split())
N = map(int, input().split())
l = []
count = 0
for i in range(N):
if(l[i] == 'X' and l[i+1] == 'Y'):
count == count + 1
print(count)
elif(l[i] == 'X' and l[i+1] == 'Y'):
count == count + 1
print(count)
elif(l[i] == 'X' and l[i+1] == 'X'):
count = count
print(count)
else:
count = count
print(count)
Learning course: Greedy Algorithms
Problem Link: Chef and String Practice Problem in Greedy Algorithms - CodeChef