Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication24
- {
- class Program
- {
- public static bool IsPalindrome(string value)
- {
- int min = 0;
- int max = value.Length - 1;
- while (true)
- {
- if (min > max)
- {
- return true;
- }
- char a = value[min];
- char b = value[max];
- if (char.ToLower(a) != char.ToLower(b))
- {
- return false;
- }
- min++;
- max--;
- }
- }
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- while (input != "ReadMe")
- {
- bool palindrom = IsPalindrome(input);
- if (palindrom && !input.Contains(" ") && !input.Contains("_"))
- {
- Console.WriteLine("YES");
- }
- else
- {
- Console.WriteLine("NO");
- }
- input = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment