Coding Quiz - Reverse Words
In this coding quiz, your task is to write a function that reverses a string using a stack data structure.
Write a function that receives a string, inserts each character into a stack, and then outputs the string in reverse order.
Write Your Code Here
def solution(input_string):
# Write your code here
return
Constraints
-
The length of the input string is between 1 and 100.
-
The string consists of lowercase alphabetic characters only.
Examples
-
Input:
"hello"
-
Output:
"olleh"
-
Input:
"algorithm"
-
Output:
"mhtirogla"
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.