Advertisement
VitalyD

Untitled

Jan 21st, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using System.Text;
  4.  
  5. namespace ConsoleApp10
  6. {
  7.     class Program
  8.     {
  9.         private static void Main()
  10.         {
  11.             string[] lines = File.ReadAllLines("dictionary.txt");
  12.             HashSet<string> dictionary = new HashSet<string>(lines);
  13.  
  14.             IEnumerator<string> data;
  15.             data = File.ReadLines("text.txt").GetEnumerator();
  16.  
  17.             var html = new FileStream("ansver.html", FileMode.Create);
  18.  
  19.             while (data.MoveNext())
  20.             {
  21.                 if (data.Current == null) continue;
  22.                 foreach (string word in data.Current.Split(' '))
  23.                 {
  24.                     if (dictionary.Contains(word))
  25.                     {
  26.                         yield return "<b><i>" + word + "</i></b>";
  27.                     }
  28.                 }
  29.             }
  30.  
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement