Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Simplified palindrome test using stack
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { Stack<char> stack = new Stack<char>(); string input = "qwertysytrewq"; input = input.ToUpper(); foreach (char c in input) { stack.Push(c); } bool flag = true; foreach (char c in input) { if (c != stack.Pop()) { flag = false; break; } } Console.WriteLine(flag); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
get it
string concat
FINAL PRIME NUMBER GENERATOR IN C#
Roman Numbers, Sorting through IComparer
services
eu odeio minha vida
Delegaty Func
Interviews
User
DNA Programmer
Please log in to post a comment.