Skip to content

Instantly share code, notes, and snippets.


gdyrrahitis/Reverser.cs Secret

Last active Nov 9, 2018
What would you like to do?
public static class Reverser
public static string Reverse(string word)
// Create the stack
var stack = new Stack<char>();
// Insert each character from the string input in the stack
foreach (var character in word)
// Pop characters from the stack
// and store in a StringBuilder
var builder = new StringBuilder();
while (!stack.IsEmpty)
return builder.ToString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment