Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleTests
- {
- class ConsoleTests
- {
- static void Main()
- {
- string text = "abba lamal exe bla test uni ABBA polindromes";
- string[] words = text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- bool polindrome;
- foreach (var word in words)
- {
- polindrome = true;
- for (int i = 0; i < word.Length / 2; i++)
- {
- if (word[i] != word[word.Length - i - 1])
- {
- polindrome = false;
- }
- }
- if (polindrome)
- {
- Console.WriteLine(word);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment