Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _08.Nilapdromes
- {
- using System;
- using System.Collections.Generic;
- using System.Linq;
- public class Program
- {
- public static void Main()
- {
- string word = Console.ReadLine().ToLower();
- while (word != "end")
- {
- string frontBorder = string.Empty;
- string backBorder = string.Empty;
- string border = string.Empty;
- for (int i = 0; i < word.Length/2; i++)
- {
- frontBorder = frontBorder + word[0 + i];
- backBorder = word[word.Length - 1 - i] + backBorder;
- if (frontBorder == backBorder)
- {
- border = frontBorder;
- }
- }
- if (border.Length > 0)
- {
- string core = word
- .Substring(border.Length, word.Length - (border.Length * 2));
- //string core = word.Replace(border, string.Empty);
- if (core.Length > 0)
- {
- Console.WriteLine(core + border + core);
- }
- }
- word = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement