HELP in CODEBU08

Problem link

#Here's my code:
for _ in range(int(input())) :
    loco = input()
    A,B = map(int , input().split())
    locations = []
    for i in range(len(loco)) :
        if(loco[i] == "A"):
            locations.append(i) 
        elif(loco[i] == "B"):
            locations.append(i) 
    distance = abs(locations[0] - locations[1])
    if(distance % (A + B) == 0):
        print("unsafe")
    else:
        print("safe")

It clears the sample testcases and seems correct, but is not giving AC. No error was shown when i tested it on IDE
@galencolin @ssrivastava990 @akshitm16

guys please help…

I think, the problem is with their input files. They are taking an extra space after every input, hence the RE in python. I tried your same code in CPP and got AC

1 Like

oh ok thanks