public string decryptScore(string s)
{
var firstDigitArray = new List<string>{ "f85au", "kt50e", "cmt5s", "v5072", "fc5i3", "56f7l", "7gj81", "yn90y", "5o3ko", "ntakn" };
var secondDigitArray = new List<string> { "hkym6", "xj97c", "54v6q", "nawf9", "9e1gp", "9gww9", "5oj5p", "0ba5t", "yizld", "bt064" };
var thirdDigitArray = new List<string> { "uku91", "rn2k4", "uuq78", "nkurt", "8kxqs", "9p7kc", "hd8x6", "57b6o", "7iucu", "do6bq" };
var fourthDigitArray = new List<string> { "0hdro", "0wqrc", "wa5ny", "857mg", "3f7ro", "kerph", "0mhw1", "tpb8f", "8rho3", "4hc11" };
var digitsArray = new List<List<string>>{ firstDigitArray, secondDigitArray, thirdDigitArray, fourthDigitArray };
string decryptedScore = "";
int scorelength = s.Length / 5;
for (int i = 0; i < scorelength; i++)
{
string d = s.Substring(i * 5, 5);
decryptedScore += (digitsArray[i].FindIndex(x=>x==d));
}
return decryptedScore;
}
PS: Don’t forget if scorelength
is greater or equal to 4 you’ll get an exception(since you only have 4 digitArrays
)
solved Decrypt string to number value