using System.Collections.Generic;
using System.Text.RegularExpressions;
public static void Main(string[] args)
DataTable dt = new DataTable();
Console.WriteLine("Enter What Comes Before the Blank (e.g. 1)");
string beforeBlank = Console.ReadLine();
Console.WriteLine("Enter What Comes After the Blank (e.g. =12)");
string afterBlank = Console.ReadLine();
Console.WriteLine("Enter Allowd Characters for Filling the Blank (e.g. 51+*)");
string input = Console.ReadLine();
for (int n=0; n<=input.Length; n++) {
foreach (string s in GetAllPermutations(input,n)) {
if (dt.Compute(beforeBlank + s.ToString() + afterBlank,"").ToString() == "True") Console.WriteLine(s.ToString());
static ICollection<string> result;
public static ICollection<string> GetAllPermutations(string str, int outputLength)
result = new List<string>();
MakePermutations(str.ToCharArray(), string.Empty, outputLength);
private static void MakePermutations(
if (permutation.Length < outputLength)
for (int i = 0; i < possibleArray.Length; i++)
var tempList = possibleArray.ToList<char>();
MakePermutations(tempList.ToArray(),
string.Concat(permutation, possibleArray[i]), outputLength);
else if (!result.Contains(permutation))