We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8608038 commit 04b55b9Copy full SHA for 04b55b9
Stack/P04_ReverseString.py
@@ -0,0 +1,19 @@
1
+# Author: OMKAR PATHAK
2
+
3
+# Reverse a string using Stack
4
5
+import Stack
6
7
+def reverse(string):
8
+ myStack = Stack.Stack(len(string))
9
+ for i in string:
10
+ myStack.push(i)
11
12
+ result = ''
13
+ while not myStack.isEmpty():
14
+ result += myStack.pop()
15
16
+ return result
17
18
+if __name__ == '__main__':
19
+ print(reverse('omkar'))
0 commit comments