Advertisement
Guest User

Diner -> Dinner code

a guest
Feb 22nd, 2012
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 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. using System.Windows.Forms;
  7.  
  8. namespace ConsoleApplication1 {
  9.     class Program {
  10.         [STAThread]
  11.         static void Main(string[] args) {
  12.             HashSet<string> words = new HashSet<string>(File.ReadAllLines(@"D:\SVN\Misc\TWL06.txt"));
  13.  
  14.             StringBuilder sb = new StringBuilder();
  15.             foreach (string w in words) {
  16.                 foreach (char c in w) {
  17.                     string cs = c.ToString();
  18.                     string newWord = w.Replace(cs, cs + cs);
  19.                     if (words.Contains(newWord)) {
  20.                         sb.AppendLine(String.Format("{0} -> {1}", w, newWord));
  21.                     }
  22.                 }
  23.             }
  24.             Clipboard.SetText(sb.ToString());
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement