Skip to content

Commit

Permalink
Merge pull request #591 from andreeacmaier/DataStructures_Stacks
Browse files Browse the repository at this point in the history
Reverse a string using stack. #576
  • Loading branch information
Srikant Singh authored Oct 27, 2018
2 parents c6e5233 + 5e44918 commit bb11c01
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Data Structures/Stacks/stackProj/src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import java.util.Stack;

public class Main {

public static void main(String []args) {

Stack<Character> stack = new Stack();
String in = "hacktoberfest";
for (int i = 0; i < in.length(); i++)
stack.push(in.charAt(i));
for (int i = 0; i < in.length(); i++) {
char c = (char) stack.pop();
System.out.print(c);
}
}


}
11 changes: 11 additions & 0 deletions Data Structures/Stacks/stackProj/stackProj.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

0 comments on commit bb11c01

Please sign in to comment.