Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
16 views11 pages

Xii Stack 1

Stack

Uploaded by

Nandita Pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views11 pages

Xii Stack 1

Stack

Uploaded by

Nandita Pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

BHARATHI VIDHYALAYA SENIOR SECONDARY SCHOOL

WORK SHEET – STACK


CLASS: XII SUBJECT: COMPUTER SCIENCE
1. Write a function in python, PushEl(e) to add a new element and PopEl(e) to delete a element from a
List, considering them to act as push and pop operations of the Stack data structure.
2. Write a program to implement a stack for the students (studentno, name). Just implement Pop and
display.
3. Write Addnew(Book) and Remove(Book) functions in python to add a new book and remove a book
from a List of books, considering them to act as PUSH and POP operations of the data structure Stack.
4. Write PUSH_CITY(cities) and POP_CITY(cities) methods/functions in Python to add new city name
and delete city name from a List of cities, considering them to act as push and pop operations of the
Stack data structure.
5. Write PushOn(Book) and Pop(Book) methods/functions in Python to add a new Book and delete a
Book from a list of Book titles, considering them to act as push and pop operations of the Stack data
structure.
6. Write PushOn(Student) and Pop(Student) methods/functions in Python to add a new Student and delete
a Student from a list of Student Name, considering them to act as push and pop operations of the Stack
data structure.
7. Write a function in python POP(Arr), where Arr is a stack implemented by a list of numbers. The
function returns the value deleted from the stack.
8. Write a function in Python pop(S), where S is a stack implemented by a list of items. The function
returns the value deleted from the stack.
9. Write a function in Python POP_OUT (Stk), where Stk is a stack implemented by a list of numbers.
The function returns the value which is deleted/popped from the stack.
10. Write a function in python Popstack(Lst), where Lst is a stack implemented by a list of numbers. The
function returns the value deleted from the stack.
11. Write a function in Python PUSH(A), where A is a list of numbers. From this list push all even
numbers into a stack implemented by using a list. Display the stack if it has at least one element,
otherwise display appropriate error message.
12. Write a function in Python PUSH(Arr), where Arr is a list of numbers. From this list push all numbers
divisible by 5 into a stack implemented by using a list. Display the stack if it has at least one element,
otherwise appropriate error message.
13. Write a function in Python push(S,item), where S is stack and item is element to be inserted in the
stack.
14. Write a function in Python PUSH_IN(L), where L is a list of numbers. From this
list, push all numbers which are multiple of 3 into a stack which is implemented by
using another list.
15. Write a function in Python PUSH_VAL(val), where val is a list of numbers. From this list push all odd
numbers into a stack implemented by using a list. Display the stack if it has at least one element,
otherwise display appropriate messages.
16. A dictionary Book contains name of book and its price as a pair of keys and values. Two empty list
stack_book and stack_price will be used as stack. Two function push_book() and pop_book() is
defined and can perform following operation
(a) Push_book() :- It reads the dictionary Book and add names of the book into stack_book and rice
into stack_price for all books whoseprice ismore than 1000rupees.
(b) Pop_book() :- it removes last book and last price from both lists and print. It should also print
“underflow” if there is nothing to remove

For example
Book={‘CS’:450, ‘IP’:550,’PhEdu’:1070,’Account’:360,’Bst’:600,’Physics’:1200, ‘Chemistry’:1400,
‘Biology’:900}
Possible values of stack_book and stack_price afterPush_book() execution may be
[‘PhEdu’,’Physics’,’Chemistry] and [1070,1200,1400]
17. A dictionary contains the names of some cities and their population in crore. Write a python function
push (stack, data), that accepts an empty list, which is the stack and data, which is the dictionary and
pushes the names of those countries onto the stack whose population is greater than 25 crores.

For example :
The data is having the contents {'India':140, 'USA':50, 'Russia':25, 'Japan':10} then the execution of the
function push () should push India and USA on the stack.
18. A dictionary stu contains rollno and marks of students. Two empty list stack_roll and stack_mark will
be used as stack. Two function push_stu() and pop_stu() is defined and perfom following operation
(a) Push_stu() :- It reads dictionary stu and add keys into stack_roll and values into stack_marks for all
students who secured more than 60 marks.
(b) Pop_stu() :- it removes last rollno and marks from both list and print “underflow” if there is nothing
to remove

For example
stu={1:56,2:45,3:78,4:65,5:35,6:90}
values of stack_roll and stack_mark after push_stu()
[3,4,6] and {78,65,90}
19. A list contains following record of a customer: [Customer_name, Phone_number, City]
Write the following user defined functions to perform given operations on the stack named ‘status’:
(i) Push_element() - To Push an object containing name and Phone number of customers who live in
Goa to the stack
(ii) Pop_element() - To Pop the objects from the stack and display them. Also, display “Stack Empty”
when there are no elements in the stack.

For example:
If the lists of customer details are:
[“Gurdas”, “99999999999”,”Goa”]
[“Julee”, “8888888888”,”Mumbai”] [“Murugan”,”77777777777”,”Cochin”]
[“Ashmit”, “1010101010”,”Goa”]
The stack should contain
[“Ashmit”,”1010101010”]
[“Gurdas”,”9999999999”]
The output should be:
[“Ashmit”,”1010101010”]
[“Gurdas”,”9999999999”]
Stack Empty
20. A list contains following record of a doctor: [Doc_ID, Doc_name, Phone_number, Speciality]
Write the following user defined functions to perform given operations on the stack named "status":
(i) Push_element() - To Push an object containing Doc_ID and Doc_name of doctors who specialize in
Anesthesia to the stack.
(ii) Pop_element() - To Pop the objects from the stack and display them. Also, display “Stack Empty”
when there are no elements in the stack.

For example: If the lists of Doctors' details are:


['D01', "Gurdas", “99999999999”,"Anesthesia”]
["D02", "Julee", “8888888888”,"cardiology"]
["D03",“Murugan”,”77777777777”,”Anesthesia”]
["D04",“Ashmit”, “1010101010”,”Medicine”]
The stack should contain
['D03', 'Murugan']
['D01', 'Gurdas']
The output should be:
['D03', 'Murugan']
['D01', 'Gurdas']
Stack Empty
21. A list contains following record of a student: [student_name, age, hostel]
Write the following user defined functions to perform given operations on the stack named
‘stud_details’:
(i) Push_element() - To Push an object containing name and age of students who live in hostel “Ganga”
to the stack
(ii) Pop_element() - To Pop the objects from the stack and display them. Also, display “Stack Empty”
when there are no elements in the stack.

For example:
If the lists of customer details are:
[“Barsat”,17,”Ganga”]
[“Ruben”, 16,”Kaveri”]
[“Rupesh”,19,”Yamuna”]
The stack should contain
[“Barsat”,17,”Ganga”]
The output should be:
[“Barsat”,17,”Ganga”]
Stack Empty
22. A list contains following record of a student:
[student_name, marks, subject]
Write the following user defined functions to perform given operations on the stack named ‘status’:
(i) Push_element() - To Push an object containing name and marks of a student who scored more than
75 marks in ‘CS’ to the stack
(ii) Pop_element() - To Pop the objects from the stack and display them. Also, display “Stack Empty”
when there are no elements in the stack.

For example:
If the lists of customer details are:
[“Danish”,80,”Maths”]
[“Hazik”,79,”CS”]
[“Parnik”,95,”Bio”]
[“Danish”,70,”CS”]
[“Sidhi”,99,”CS”]
The stack should contain
[“Hazik”,”79”]
[“Sidhi”,”99”]
The output should be:
[“Hazik”,”79”]
[“Sidhi”,”99”]
Stack Empty
23. A list contains following record of a student: [Rno, Name, Dob, Class]
Write the following user defined functions to perform given operations on the stack named ‘status’:
(i) Push_element() - To Push an record of student to the stack
(ii) Pop_element() - To Pop the objects from the stack and display them. Also, display “Stack Empty”
when there are no elements in the stack.
24. A list FJList contains following record as list elements: [FoodJoint, Cuisine, Rating]
Each of these records are nested together to form a nested list. Write the following user defined
functions in Python to perform the specified operations on the stack named MustGo.
(i) Push_element(FJList, MustGo): It takes the nested list as an argument and pushes a list object
containing name of FoodJoint and its Cuisine is other than Chinese and has rating more than 4.
(ii) Pop_element(MustGo): It pops the objects from the stack passed as an argument and displays them
one by one. Also, the function should display ‘Stack Empty’ when there are no elements in the stack.

For example: If the nested list contains the following data:


FJList = [ [‘Divine Palace’, ‘Indian’, 4.8],
[‘Ching’, ‘Chinese’, 4.2], [‘The Lama’, ‘Thai’, 3.9],
[‘Le Cirque’, ‘French’, 4.5]]
The stack should contain:
[[‘Divine Palace’, ‘Indian’, 4.8],
[‘Le Cirque’, ‘French’, 4.5]]
The output should be:
[‘Le Cirque’, ‘French’, 4.5]
[‘Divine Palace’, ‘Indian’, 4.8]
Stack Empty
25. A list HList contains following record as list elements: [HeritageName, City, distance from Bikaner]
Each of these records are nested together to form a nested list. Write the following user defined
functions in Python to perform the specified operations on the stack named ToVisit.
(i) Push(HList): It takes the nested list as an argument and pushes a list object containing name of the
heritage site and city, which are not in Bikaner and distance is less than 150 km from Bikaner.
(ii) Pop(): It pops the objects from the stack and displays them. Also, the function should display
“Stack Empty” when there are no elements in the stack.

For example: If the nested list contains the following data:


HList=[ [‘Gajner Palace’, Kolayat, 51],
[‘Hawa Mahal’, ‘Jaipur’ ,340],
[‘Karni Mata Temple’, ‘Deshnok’, 30],
[‘Ummed Bhawan’, ‘Jodhpur’, 240] ]
The stack should contain:
[‘Gajner Palace’, Kolayat, 51],
[‘Karni Mata Temple’, ‘Deshnok’, 30]
The output should be:
[‘Karni Mata Temple’, ‘Deshnok’, 30]
[‘Gajner Palace’, Kolayat, 51]
Stack Empty
26. A list named as Record contains following format of for students: [student_name, class, city].
Write the following user defined functions to perform given operations on the stack named ‘Record’:
(i) Push_record(Record) – To pass the list Record = [ ['Rahul', 12,'Delhi'], [‘Kohli',11,'Mumbai'],
['Rohit',12,'Delhi'] ] and then Push an object containing Student name, Class and City of student
belongs to ‘Delhi’ to the stack Record and display and return the contents of stack
(ii) Pop_record(Record) – To pass following Record [[“Rohit”,”12”,”Delhi”] [“Rahul”, 12,”Delhi”] ]
and then to Pop all the objects from the stack and at last display “Stack Empty” when there is no
student record in the stack.

Thus the output should be: -


[“Rohit”,”12”,”Delhi”]
[“Rahul”, 12,”Delhi”]
Stack Empty
27. A list named as Record contains following format of for students: [student_name, class, city].
Write the following user defined functions to perform given operations on the stack named ‘Record’:
(i) Push_record(Record) – To pass the list Record = [ ['Rahul', 12,'Delhi'], [‘Kohli',11,'Mumbai'],
['Rohit',12,'Delhi'] ] and then Push an object containing Student name, Class and City of student
belongs to ‘Delhi’ to the stack Record and display and return the contents of stack
(ii) Pop_record(Record) – To pass following Record [[“Rohit”,”12”,”Delhi”] [“Rahul”, 12,”Delhi”] ]
and then to Pop all the objects from the stack and at last display “Stack Empty” when there is no
student record in the stack.

Thus the output should be: -


[“Rohit”,”12”,”Delhi”]
[“Rahul”, 12,”Delhi”]
Stack Empty
28. A list, items contain the following record as list elements [itemno, itemname, stock]. Each of these
records are nested to form a nested list. Write the following user defined functions to perform the
following on a stack reorder .
i. Push(items)- it takes the nested list as its argument and pushes a list object containing itemno and
itemname where stock is less than 10
ii. Popitems() -It pops the objects one by one from the stack reorder and also displays a message ‘Stack
empty’ at the end.
29. A nested list contains the data of visitors in a museum. Each of the inner lists contains the following
data of a visitor: [V_no (int), Date (string), Name (string), Gender (String M/F), Age (int)]
Write the following user defined functions to perform given operations on the stack named "status":
(i) Push_element(Visitors) - To Push an object containing Gender of visitor who are in the age range of
15 to 20.
(ii) Pop_element() - To Pop the objects from the stack and count and display the number of Male and
Female entries in the stack. Also, display “Done” when there are no elements in the stack.

For example: If the list of Visitors contains:


[['305', "10/11/2022", “Geeta”,"F”, 35],
['306', "10/11/2022", “Arham”,"M”, 15],
['307', "11/11/2022", “David”,"M”, 18],
['308', "11/11/2022", “Madhuri”,"F”, 17],
['309', "11/11/2022", “Sikandar”,"M”, 13]]
The stack should contain
F
M
M
The output should be:
Female: 1
Male: 2
Done
30. Alam has a list containing 10 integers. You need to help him create a program with separate user
defined functions to perform the given operations based on this list.
(a) Traverse the content of the list and push the even numbers into a stack.
(b) Pop and display the content of the stack.

For example, If the sample content of the list is as follows


N = [12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
Sample Output of the code should be:
38 22 98 56 34 12
31. Alam has a list containing 10 integers. You need to help him create a program with separate user
defined functions to perform the following operations based on this list.
l Traverse the content of the list and push the even numbers into a stack.
l Pop and display the content of the stack.

For Example:
If the sample Content of the list is as follows:
N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
Sample Output of the code should be:38 22 98 56 34 12
32. Anil has created a list, X containing marks of 5 students. Write a program, with separate user defined
function to perform the following operation:
PUSH()- Traverse the content of the List, L and push all the odd marks into the stack, S
POP()- Pop and display the content of the stack.

Example: If the content of the list is as follows:


L=[81, 94, 63, 19, 62]
Then the output of the code should be: 19 63 81 empty
33. Given a Dictionary Stu_dict containing marks of students for three test-series in the form Stu_ID:(TS1,
TS2, TS3) as key-value pairs. Write a Python program with the following user-defined functions to
perform the specified operations on a stack named Stu_Stk
(i) Push_elements(Stu_Stk, Stu_dict) : It allows pushing IDs of those students, from the dictionary
Stu_dict into the stack Stu_Stk, who have scored more than or equal to 80 marks in the TS3 Test.
(ii) Pop_elements(Stu_Stk): It removes all elements present inside the stack in LIFO order and prints
them. Also, the function displays 'Stack Empty' when there are no elements in the stack. Call both
functions to execute queries.

For example:
If the dictionary Stu_dict contains the following data:
Stu_dict ={5:(87,68,89), 10:(57,54,61), 12:(71,67,90),
14:(66,81,80), 18:(80,48,91)}
After executing Push_elements(), Stk_ID should contain
[5,12,14,18]
After executing Pop_elements(), The output should be:
18
14
12
5
Stack Empty
34. List contains following record of a Book : [Book Name, Write Name, Price]
Write the following user defined functions to perform given operations on the stack named “BOOK” :
(i) Push_Rec( ) – To push the record containing Book name and author name of Books having price >
500 to the stack.
(ii) Pop_Rec( ) – To pop the objects from the stack and display them. Also display “STACK
UNDERFLOW” when there are no elements in the Stack.
35. Mr.Abhishek has created a list of elements. Help him to write a program in python with functions,
PushEl (S,element) and PopEl (S) to add a new element and delete an element from a List of element
named ‘S’ considering them to act as push and pop operations of the Stack data structure . Push the
element into the stack only when the element is divisible by 4.

For eg:if L=[2,5,6,8,24,32]


then stack content will be
32 <- Top
24
8
36. Mr.Ajay has created a list of elements. Help him to write a program in python with functions,
PushEl(element) and PopEl(element) to add a new element and delete an element from a List of
element Description, considering them to act as push and pop operations of the Stack data structure .
Push the element into the stack only when the element is divisible by 4.

For eg:if L=[2,5,6,8,24,32]


then stack content will be 32 24 8
37. Suppose you have a list of employees with their project completion status stored in a dictionary named
‘emp_dict’. The dictionary has employee IDs as keys, and the corresponding values are tuples
representing the completion status of three projects (Proj1, Proj2, Proj3) for each employee. Write a
Python program with the following user-defined functions to perform operations on a stack named
‘Proj_Stk’:
(i) Push_projects(Proj_Stk, Emp_dict): This function should push the IDs of those employees into the
stack ‘Proj_Stk’ who have successfully completed all three projects.
(ii) Pop_projects(Proj_Stk): This function should remove all elements from the stack in LIFO order
and print them. If the stack is empty, it should display 'Stack Empty.'
Call both functions to execute queries.

For example:
If the dictionary ‘emp_dict’ contains the following data:
emp_dict = {101: (True, True, True), 102: (False, True, True), 103: (True, True, False), 104: (True,
True, True), 105: (False, False, False)}
After executing Push_projects(), Proj_Stk should contain [101, 104].
After executing ‘Pop_projects()’ , the output should be:
104
101
Stack Empty
38. Thushar received a message(string) that has upper case and lower-case alphabet. He want to extract all
the upper case letters separately .Help him to do his task by performing the following user defined
function in Python:
a) Push the upper case alphabets in the string into a STACK
b) Pop and display the content of the stack.

For example:
If the message is “All the Best for your Pre-board Examination”
The output should be : E P B A
39. Two list Book and price contains name of book and price of book respectively. A list named stack is
empty. Write two functions as given below
(i) Push() :- it will append the name of a book into stack whose price is more than 1000
(ii) Pop() :- it will remove the last book of the stack and print its name. It should also print “underflow”
if there is nothing to remove

For example the two lists has following data


Book=[‘CS’, ‘IP’,’PhEdu’,’Account’,’Bst’,’Physics’, ‘Chemistry’, ‘Biology’]
Price=[450,550,1070,360,600,1200,1400,900]
After Push() the contains of stack is
[‘PhEdu’,’Physics’,’Chemistry]
The output of first execution of Pop() is
The removed book is ‘Chemistry’
40. Two list Lname and Lage contains name of person and age of person respectively. A list named
Lnameage is empty. Write functions as details given below
(i) Push_na() :- it will push the tuple containing pair of name and age from Lname and Lage whose age
is above 50
(ii) Pop_na() :- it will remove the last pair of name and age and also print name and age of removed
person. It should also print “underflow” if there is nothing to remove

For example the two lists has following data


Lname=[‘narender’, ‘jaya’, ‘raju’, ‘ramesh’, ‘amit’, ‘Piyush’]
Lage=[45,23,59,34,51,43]
After Push_na() the contains of Lnameage stack is
[(‘raju’,59),(‘amit’,51)]
The output of first execution of pop_na() is
The name removed is amit
The age of person is 51
41. Vedika has created a dictionary containing names and marks as key-value pairs of 5 students. Write a
program, with separate user-defined functions to perform the following operations:
(i) Push the keys (name of the student) of the dictionary into a stack, where the corresponding value
(marks) is greater than 70.
(ii) Pop and display the content of the stack.

The dictionary should be as follows:


d={“Ramesh”:58, “Umesh”:78, “Vishal”:90, “Khushi”:60, “Ishika”:95}
Then the output will be:
Umesh Vishal Ishika
42. Write a function DeleteCustomer() to delete a Customer information from a list of CStack. The
function delete the name of customer from the stack.

Example: If the stack contains [“Abhinav”,”Vimank”],


the output should be:
Vimank
Abhinav
43. Write a function in Python, Push(BItem) where , BItem is a dictionary containing the details
of bakery items–{Bname:price}.
The function should push the names of those items in the stack S which has price less than 50.

For example:
If the dictionary contains the following data:
Bitem={"Bread":40,"Cake":250,"Muffins":80,"Biscuits":25}
The stack should contain
Bread
Biscuits
44. Write a function in Python, Push(book) where, book is a dictionary containing the details of a book in
form of {bookno : price}.
The function should push the book in the stack which have price greater than 300. Also display the
count of elements pushed into the stack.

For example:
If the dictionary contains the following data:
Dbook={"Python":350,"Hindi":200,"English":270,"Physics":600, “Chemistry”:550}
The stack should contain
Chemistry
Physics
Python
The output should be:
The count of elements in the stack is 3
45. Write a function in Python, Push(Cosmetics) where, Cosmetic is a dictionary containing the details of
products– {Pname:price}.
The function should push the names of those products in the stack whose price is greater than 130.
Also display the count of elements pushed into the stack.

For example:
If the dictionary contains the following data:
Ditem = {“FaceWash”:105, "Facepack":150, "CleansingMilk":130,
"Sunscreen": 180, "FaceMask":115}
The stack should contain
Facepack
Sunscreen
The output should be:
The count of elements in the stack is 2
46. Write a function in Python, Push(emp) where , emp is a dictionary containing the details of employees
– {empname:salary}.
The function should push the names of those employees in the stack who have salary less than 15000.
Also display the count of elements pushed into the stack.

For example:
If the dictionary contains the following data:
Employee ={"Sohan”:20000,”Mohan”:9000,”Rohan”:25000,”Aman”:5000}
The stack should contain
Mohan
Aman
The output should be:
The count of elements in the stack is 2
47. Write a function in Python, Push(EventDetails) where , EventDetails is a dictionary containing the
number of persons attending the events– {EventName : NumberOfPersons}. The function should push
the names of those events in the stack named ‘BigEvents’ which have number of persons greater than
200. Also display the count of elements pushed o n to the stack.
For example:
If the dictionary contains the following data:
EventDetails ={"Marriage":300, "Graduation Party":1500, "Birthday Party":80,
"Get together" :150}
The stack should contain :
Marriage
Graduation Party
The output should be:
The count of elements in the stack is 2
48. Write a function in Python, Push(Item) where Item is a list containing the details of Bakery Items –
[[Name, Price], [Name, Price], [Name, Price]]
The function should push the names of those items in the Stack who have price less than Rs. 50. Also
display the count of elements pushed into the Stack.

Example:
If the list contains the following items :
l=[['ravi',26],['raman',36], ['chaman',56]]
The Stack should contain :
Ravi
Raman
The output should be :
The number of elements in stack is : 2
49. Write a function in Python, Push(KItem),where KItem is a dictionary containing the details of Kitchen
items– {Item:price}.
The function should push the names of those items in a stack which have price less than 100. Also
display the average price of elements pushed into the stack.

For example: If the dictionary contains the following data:


{"Spoons":116,"Knife":50,"Plates":180,"Glass":60}
The stack should contain
Glass
Knife
The output should be:
The average price of an item is 55.0
50. Write a function in Python, Push(SItem) where , SItem is a dictionary containing the details of
stationary items– {Sname:price}.
The function should push the names of those items in the stack who have price greater than 75. Also
display the count of elements pushed into the stack.

For example:
If the dictionary contains the following data:
Ditem={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}
The stack should contain
Notebook
Pen
The output should be:
The count of elements in the stack is 2
51. Write the definition of a user defined function Push3_5 (N) which accepts a list of integers in a
parameter
N and pushes all those integers which are divisible by 3 or divisible by 5 from the list N into a list
named
Only3_5.
l Write a program in Python to input 5 integers into a list named NUM. The program should then use
the function Push 3_5 ( ) to create the stack of the list Only3_5. Thereafter pop each integer from the
list Only3_5 and display the popped value. When the list is empty, display the message "StackEmpty":

For example:
If the integers input into the list NUM are :
[10, 6, 14, 18, 30]
Then the stack Only 3_5 should store
[10, 6, 18, 30]
And the output should be displayed as
30 18 6 10 StackEmpty
52. Write the definition of a user defined function PushNV(N) which accepts a list of strings in the
parameters N and pushes all strings which have no vowels present in it, into a list named NoVowel.
Write a program in python to input 5 words and push them one by one into a list named All.
The program should then use the function PushNV() to create a stack of words in the list NoVowel so
that it stores only those words which do not have any vowels in it, from the list All.
Thereafter , pop each word from the list NoVowel and display the message “EmptyStack”
For example:
If the words accepted and pushed into the list All are
[‘DRY’,’LIKE’,’RHYTHM’,’WORK’,’GYM’]
Then the stack NoVowel should store
[‘DRY’,’RHYTHM’,’GYM’]
And the output should be displayed as
GYM RHYTHM DRY EmptyStack

You might also like