Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace _02.ExtractSentencesByKeyWord
- {
- class ExtractSentencesByKeyWord
- {
- static void Main()
- {
- string word = Console.ReadLine();
- string[] text = Console.ReadLine().Split(new char[] { '.', '!', '?' }, StringSplitOptions.RemoveEmptyEntries);
- foreach (string sentence in text)
- {
- string[] words = sentence.Split(new char[] { ' ', ',', '<', '>', '/', '\\', '/', '@', '#', '$', '%', '^', '&', '*', '(', ')', '[', ']', '{', '}', '|' });
- if (words.Contains(word))
- {
- Console.WriteLine(sentence.Trim());
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement