Advertisement
peanutcookies

Programming Praxis: NPR Sunday Puzzle

Feb 22nd, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6.  
  7. namespace ConsoleApplication1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             StreamReader reader = new StreamReader("wordlist.txt");
  14.             string line;
  15.             string baseChars = "bfcdae";
  16.             bool match;
  17.  
  18.             while (!reader.EndOfStream)
  19.             {
  20.                 line = reader.ReadLine();
  21.  
  22.                 if (line.Length == 8)
  23.                 {
  24.                     match = true;
  25.                     foreach (char c in baseChars)
  26.                     {
  27.                         if (!line.Contains(c))
  28.                         {
  29.                             match = false;
  30.                             break;
  31.                         }
  32.                     }
  33.  
  34.                     if (match)
  35.                     {
  36.                         Console.WriteLine("Match: {0}", line);
  37.                     }
  38.                 }
  39.             }
  40.  
  41.             Console.ReadLine();
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement