Advertisement
Guest User

Untitled

a guest
May 27th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. class Program
  8.     {
  9.     static void Main()
  10.     {
  11.         string searchedWord = Console.ReadLine();
  12.         string manySentences = Console.ReadLine();
  13.         searchedWord.ToLower();
  14.         manySentences.ToLower();
  15.         string[] splittedSentences = manySentences.Split('.');
  16.         for (int i = 0; i < splittedSentences.Length; i++)
  17.         {
  18.             string[] splittedSentencesBySpace = splittedSentences[i].Split(' ');
  19.             for (int j = 0; j < splittedSentencesBySpace.Length; j++)
  20.             {
  21.                 if (splittedSentencesBySpace[j] == searchedWord)
  22.                 {
  23.                     Console.Write(splittedSentences[i] + ".");
  24.                     continue;
  25.                 }
  26.                 for (int z = 0; z < splittedSentencesBySpace[j].Length; z++)
  27.                 {
  28.                     if (char.IsLetter(splittedSentencesBySpace[j][z]) == false)
  29.                     {
  30.                         string[] splitByNonLetterSymbol = splittedSentencesBySpace[j].Split(splittedSentencesBySpace[j][z]);
  31.                         for (int p = 0; p < splitByNonLetterSymbol.Length; p++)
  32.                         {
  33.                             if (splitByNonLetterSymbol[p] == searchedWord)
  34.                             {
  35.                                 Console.Write(splittedSentences[i]+".");
  36.                                 z = splittedSentencesBySpace[j].Length;
  37.                             }
  38.                         }
  39.                     }
  40.                 }
  41.             }
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement