Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace ConsoleTests
- {
- class ConsoleTests
- {
- static void Main()
- {
- string input = Console.ReadLine();
- string wordSearched = Console.ReadLine();
- Extract(input, wordSearched);
- }
- public static void Extract(string str, string keyword)
- {
- string[] arr = str.Split('.');
- string answer = string.Empty;
- foreach(string sentence in arr)
- {
- string[] words = sentence.Split(new char[] { ' ', ',' });
- if(words.Contains(keyword,StringComparer.CurrentCultureIgnoreCase))
- {
- Console.WriteLine(sentence.Trim()+'.');
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment