Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace ExtractSentencesbyKeyword
- {
- class ExtractSentencesbyKeyword
- {
- static void Main(string[] args)
- {
- string keyword = Console.ReadLine().ToLower();
- List<string> text = Console.ReadLine().Split('.', '!', '?').ToList();
- for (int sentence = 0; sentence < text.Count; sentence++)
- {
- string[] result = text[sentence].Split(new char[] { ',', ':', '(', ')', '[', ']', '\"', '\'', '/', '\\', ' ' }, StringSplitOptions.RemoveEmptyEntries);
- if (result.Contains(keyword))
- {
- Console.WriteLine(text[sentence].Trim());
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement