Skip to content

Instantly share code, notes, and snippets.

@davwheat
Created December 25, 2018 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davwheat/07f754e0f1df0f9c682383f38213a38d to your computer and use it in GitHub Desktop.
Save davwheat/07f754e0f1df0f9c682383f38213a38d to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
class MainClass {
static readonly char[] ee = {'b', 'c', 'd', 'e', 'g', 'p', 't', 'v', 'z'};
static readonly char[] ay = {'a', 'h', 'j', 'k'};
static readonly char[] ess = {'f', 's', 'x'};
static readonly char[] ii = {'i', 'y'};
static readonly char[] em = {'m', 'n'};
static readonly char[] u = {'q', 'u'};
public static void Main (string[] args) {
Console.Write("Enter text: ");
var UserInput = Console.ReadLine();
Console.WriteLine();
Console.WriteLine("We're going to test every possibility. This may take a while...");
Console.WriteLine();
foreach (char c in UserInput) {
Console.WriteLine("==========");
Console.WriteLine(c);
var chars = GetAllPossibleChars(char.ToLower(c));
if (chars == null) {
continue;
}
if (char.IsUpper(c)) {
chars = CapitaliseCharArray(ref chars);
}
Console.WriteLine(chars);
}
}
static char[] GetAllPossibleChars(char c) {
char[] array;
c = char.ToLower(c);
Console.WriteLine(c);
if (ee.Contains(c))
array = ee;
else if (ay.Contains(c))
array = ay;
else if (ess.Contains(c))
array = ess;
else if (ii.Contains(c))
array = ii;
else if (em.Contains(c))
array = em;
else if (u.Contains(c))
array = u;
else {
Console.WriteLine("YEET");
return null;
}
return array;
}
static char[] CapitaliseCharArray(ref char[] array) {
var i=0;
foreach (char c in array) {
array[i] = char.ToUpper(c);
i++;
}
return array;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment