My issue
Wrong Answer
My code
def find_resultant_string(n, s):
alice_turn = True # True for Alice, False for Bob
t = ""
while s:
if alice_turn:
# Alice's turn
t += s[0]
s = s[1:]
else:
# Bob's turn
t += s[-1]
s = s[:-1]
alice_turn = not alice_turn # Switch turns
return t
def main():
t = int(input("Enter the number of test cases: "))
for _ in range(t):
n = int(input())
s = input().strip()
result = find_resultant_string(n, s)
print(result)
if __name__ == "__main__":
main()
Learning course: Stacks and Queues
Problem Link: Suspense String Practice Problem in Stacks and Queues - CodeChef