I am getting correct output but my submission shows wrong, problem code : TWTCLOSE

n, ck = map(int, input().split())
lis = []
co = 0
for _ in range(ck):
    cl = input()
    xt = cl[len(cl)-1]
    if xt.isdigit():
        if xt in lis:
            lis.remove(xt)
        else:
            lis.append(xt)
    else:
        lis.clear()
        
    print(len(lis))

please this and check what’s going wrong

Put link of your submission.
Also IDK Python i will try to code in c++ or java.

1 Like

cl=input()
Here If input given line is
CLICK 43,
Then cl=“CLICK 43”
and not cl=[“CLICK”, “43”]

so in, xt=cl[len(cl)-1] it will store ‘3’ in xt and not “43”

So, instead of cl=input()
Write cl=list(input().split())

Your modified code: https://www.codechef.com/viewsolution/35727919

1 Like

thank you bro❤

Bro here is the link you have asked for https://www.codechef.com/viewsolution/35712681
But I already got the solution, by the way thank for your effort.