Reversing a string

Report a typo

Given a number n followed by a sequence of n characters, print them in the reverse order.

Put the characters in a stack and then pop, and print them one by one.

Sample Input 1:

5
s
t
a
c
k

Sample Output 1:

k
c
a
t
s
Write a program in Python 3
n = int(input())

my_stack = ...
___

Create a free account to access the full topic