My issue
My code
# Update the code below to solve the problem
t = int(input())
for i in range(t):
X = int(input())
S = input()
if S.count('c')>S.count('n'):
print(60*X)
elif S.count('c')<S.count('n'):
print(40*X)
else :
print(55*X)
Learning course: Solve Programming problems using Python
Problem Link: CodeChef: Practical coding for everyone
@abhimessi096
You have used small c and small n, while in the problem it is using capital letters. This might be causing the errors in your code.
Here is my code for reference. The way you are doing is also correct.
# Update the code below to solve the problem
t = int(input())
for i in range(t):
X = int(input())
S = input()
car=0
chef=0
for i in S:
if(i=='C'):
car+=1
elif(i=='N'):
chef+=1
else:
pass
if(car>chef):
print(60*X)
elif(car==chef):
print(55*X)
else:
print(40*X)