Handle the input in python

Here is my code I don’t where is problem occurring or what should I do handle the input provided by codechef.

for test in range(int(input())):

a = list(map(str,input().split()))
seto  = set(a)
dicto = {}
for i  in range(len(a)):
    if a[i] == "s":
        dicto["s"] += -1
        if ((a[i-1] == "m") and (a[i] == "m") and (a[i+1]) == "m"):
            dicto["m"] += 1
            dicto["m"] += 2
if dicto["m"] > dicto["s"] :
elif dicto["m"]< dicto["s"]:

Can you please specify which problem are you facing.

Copy paste the URL of the submission. As @anon56435095 said we cannot help unless you give us more context. If you are not familiar with the platform you can mention the difficulties you are facing and we will take it from there.

As per given information I tried to execute the code on online ide
and here is result you can check by entering input here check Output

The error which is occuring in your program is key Error. It occurs because dictionary is empty and you are trying to increment or decrement value of specified key.

Tip: Whenever you play with Python dictionary always use in operator to check whether key-value pair exists or not or You can use defaultdict.