context: using System;
  using System.Collections;
  using System.Collections.Generic;
  using System.Text;
  
  namespace mpmist
  {
  	/// <summary>
  	/// New York State Identification and Intelligence System (NYSIIS) Phonetic Encoder
  	/// </summary>
  	public class NYSIIS
  	{
  	    static string[] common_words = {
  	        "a",
  	        "an",
  	        "am",
  	        "at",
  	        "to",
  	        "as",
  	        "we",
  	        "i",
  	        "in",
  	        "is",
  			"than",
  			"does",
  			"did",
  	        "it",
  	        "if",
  	        "be",
  	        "by",
  	        "so",
  	        "no",
  	        "last",
  	        "first",
  	        "on",
  	        "of",
  	        "its",
  	        "all",
  	        "can",
  	        "into",
  	        "from",
  	        "just",
  	        "and",
  	        "the",
  	        "over",
  	        "under",
  	        "for",
  	        "then",
  	        "dont",
  	        "has",
  	        "get",
  	        "got",
  	        "had",
  	        "should",
  	        "hadnt",
  	        "have",
  	        "some",
  	        "come",
  	        "this",
  	        "call",
  	        "that",
  	        "thats",
  	        "find",
  	        "these",
  	        "them",
  	        "look",
  	        "looked",
  	        "looks",
  	        "with",
  	        "but",
  	        "about",
  	        "where",
  	        "possible",
  	        "sometimes",
  	        "which",
  	        "they",
  	        "just",
  	        "we",
  	        "while",
  	        "whilst",
  	        "their",
  	        "perhaps",
  	        "you",
  	        "make",
  	        "any",
  	        "say",
  	        "been",
  	        "like",
  	        "form",
  	        "our",
  	        "give",
  	        "in the",
  	        "in a",
  	        "will",
  	        "object",
  	        "shall",
  	        "will not",
  	        "until",
  	        "take",
  	        "other",
  	        "now",
  	        "lead",
  	        "taken",
  	        "you can",
  	        "have to",
  	        "have some",
  	        "would",
  	        "said",
  	        "one",
  	        "how",
  	        "new",
  	        "we",
  	        "said",
  	        "it",
  	        "was",
  	        "are",
  	        "every",
  	        "such",
  	        "more",
  	        "different",
  	        "example",
  	        "way",
  	        "only",
  	        "often",
  	        "show",
  	        "group",
  	        "itself",
  	        "part",
  	        "saw",
  	        "making",
  	        "could",
  	        "need",
  	        "out",
  	        "being",
  	        "been",
  	        "yet",
  	        "lack",
  	        "even",
  	        "own",
  	        "much",
  	        "of this",
  	        "become",
  	        "keep",
  	        "keeps",
  	        "do",
  	        "having",
  	        "normal",
  	        "this",
  	        "after",
  	        "before",
  	        "during",
  	        "off",
  	        "use",
  	        "same",
  	        "case",
  	        "there",
  	        "through",
  	        "end",
  	        "may",
  	        "made",
  	        "name",
  	        "most",
  	        "many",
  	        "well",
  	        "who",
  	        "is",
  	        "your",
  	        "you",
  	        "owner",
  	        "around",
  	        "about",
  	        "of",
  	        "process",
  	        "too",
  	        "my",
  	        "why",
  	        "tell",
  	        "he",
  	        "she",
  	        "what",
  	        "left",
  	        "him",
  	        "her",
  	        "ever",
  	        "there"
  	    };
  			
  		private static string TextOnly(
  		    string text)
  		{
  			string result = "";
  			char[] ch = text.ToCharArray();
  			for (int i = 0; i < text.Length; i++)
  			{
  				if (((ch[i] >= 'a') &&
  					(ch[i] <= 'z')) ||
  					((ch[i] >= 'A') &&
  					(ch[i] <= 'Z')) ||
  	                ((ch[i] >= '0') &&
  					(ch[i] <= '9')) ||
  	                (ch[i] == ' '))
  				result += ch[i];
  			}
  			return(result);
  		}
  			
  	    private static string RemoveCommonWords(
  	        string text)
  	    {
  			string result = "";
  			text = TextOnly(text);
  			text = text.ToLower();
  				
  			string[] str = text.Split(' ');
  			
  			for (int i = 0; i < str.Length; i++)
  			{
  				if (str[i] != "")
  				{
  					if (Array.IndexOf(common_words, str[i]) == -1)
  						result += str[i] + " ";
  				}
  			}
  				
  			return(result.Trim());
  		}
  			
  	    public static string ToNYSIISStandardised(string text, bool reverse) {
  			string standardised_index = "";
  			text = TextOnly(text);
  			text = RemoveCommonWords(text);
  			
  			List<string> snd = new List<string>();
  			string[] str = text.Trim().Split(' ');
  			for (int i = 0; i < str.Length; i++)
  			{
  				if (str[i] != "")
  				{
  					snd.Add(ToNYSIISCode(str[i]));
  				}
  			}
  			snd.Sort();
  			if (reverse) snd.Reverse();
  
gt: 			for (int i = 0; i < snd.Count; i++)