Advertisement
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;
- class Palindromes
- {
- static void Main()
- {
- string text = @"Nice blue sky. No exe flying in the sky. ABBA will not come in Bulgaria.
- I don`t know what is lamal, maybe I will find some day. mouseesuom";
- char[] separators = { ' ', ',', '.', '!', '\n', '\r' };
- string[] splitted = text.Split(separators, StringSplitOptions.RemoveEmptyEntries);
- foreach (string word in splitted)
- {
- bool isPalindrome = true;
- for (int j = 0; j < (word.Length / 2); j++)
- {
- if (word[j] != word[word.Length-1-j])
- {
- isPalindrome = false;
- break;
- }
- }
- if (isPalindrome&&word.Length>1)
- {
- Console.WriteLine(word);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement