private string smartJoin(string msgAdmin) {
try
{
string msgBigBuzz = "";
string jawab = "";
msgBigBuzz = msgAdmin.Substring(msgAdmin.IndexOf("Enter the right answer to start chatting.") + 42);
msgBigBuzz = msgBigBuzz.Replace(" ", "");
msgBigBuzz = msgBigBuzz.Replace("\n", "");
msgBigBuzz = msgBigBuzz.Replace("\r\n", "");
msgBigBuzz = msgBigBuzz.Replace("=...", "");
msgBigBuzz = msgBigBuzz.Replace("thousand", "");
msgBigBuzz = msgBigBuzz.Replace("hundred", "");
msgBigBuzz = msgBigBuzz.Replace("hundred", "");
msgBigBuzz = msgBigBuzz.Replace("and", ",");
msgBigBuzz = msgBigBuzz.Replace("ten", "10");
msgBigBuzz = msgBigBuzz.Replace("eleven", "11");
msgBigBuzz = msgBigBuzz.Replace("twelve", "12");
msgBigBuzz = msgBigBuzz.Replace("thirteen", "13");
msgBigBuzz = msgBigBuzz.Replace("fourteen", "14");
msgBigBuzz = msgBigBuzz.Replace("fifteen", "15");
msgBigBuzz = msgBigBuzz.Replace("sixteen", "16");
msgBigBuzz = msgBigBuzz.Replace("seventeen", "17");
msgBigBuzz = msgBigBuzz.Replace("eighteen", "18");
msgBigBuzz = msgBigBuzz.Replace("nineteen", "19");
msgBigBuzz = msgBigBuzz.Replace("twenty-", "2");
msgBigBuzz = msgBigBuzz.Replace("thirty-", "3");
msgBigBuzz = msgBigBuzz.Replace("forty-", "4");
msgBigBuzz = msgBigBuzz.Replace("fifty-", "5");
msgBigBuzz = msgBigBuzz.Replace("sixty-", "6");
msgBigBuzz = msgBigBuzz.Replace("seventy-", "7");
msgBigBuzz = msgBigBuzz.Replace("eighty-", "8");
msgBigBuzz = msgBigBuzz.Replace("ninety-", "9");
msgBigBuzz = msgBigBuzz.Replace("twenty", "20");
msgBigBuzz = msgBigBuzz.Replace("thirty", "30");
msgBigBuzz = msgBigBuzz.Replace("forty", "40");
msgBigBuzz = msgBigBuzz.Replace("fifty", "50");
msgBigBuzz = msgBigBuzz.Replace("sixty", "60");
msgBigBuzz = msgBigBuzz.Replace("seventy", "70");
msgBigBuzz = msgBigBuzz.Replace("eighty", "80");
msgBigBuzz = msgBigBuzz.Replace("ninety", "90");
msgBigBuzz = msgBigBuzz.Replace("one", "1");
msgBigBuzz = msgBigBuzz.Replace("two", "2");
msgBigBuzz = msgBigBuzz.Replace("three", "3");
msgBigBuzz = msgBigBuzz.Replace("four", "4");
msgBigBuzz = msgBigBuzz.Replace("five", "5");
msgBigBuzz = msgBigBuzz.Replace("six", "6");
msgBigBuzz = msgBigBuzz.Replace("seven", "7");
msgBigBuzz = msgBigBuzz.Replace("eight", "8");
msgBigBuzz = msgBigBuzz.Replace("nine", "9");
if (msgBigBuzz.IndexOf("-") != -1)
{
int y = Convert.ToInt32(msgBigBuzz.Substring(0, +1));
int x = Convert.ToInt32(msgBigBuzz.Substring(2, +1));
jawab = (y - x).ToString();
}
else if (msgBigBuzz.IndexOf("+") != -1)
{
int y = Convert.ToInt32(msgBigBuzz.Substring(0, +1));
int x = Convert.ToInt32(msgBigBuzz.Substring(2, +1));
jawab = (y + x).ToString();
}
else if (msgBigBuzz.IndexOf("*") != -1)
{
int y = Convert.ToInt32(msgBigBuzz.Substring(0, +1));
int x = Convert.ToInt32(msgBigBuzz.Substring(2, +1));
jawab = (y * x).ToString();
}
else if (msgBigBuzz.IndexOf("Whatisthe1stdigitof") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("of") + 2);
jawab = jawab.Substring(0, jawab.IndexOf("?") - 4);
}
else if (msgBigBuzz.IndexOf("Whatisthe2nddigitof") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("of") + 3);
jawab = jawab.Substring(0, jawab.IndexOf("?") - 3);
}
else if (msgBigBuzz.IndexOf("Whatisthe3rddigitof") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("of") + 4);
jawab = jawab.Substring(0, jawab.IndexOf("?") - 2);
}
else if (msgBigBuzz.IndexOf("Whatisthe4thdigitof") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("of") + 5);
jawab = jawab.Substring(0, jawab.IndexOf("?") - 1);
}
else if (msgBigBuzz.IndexOf("Whatisthe5thdigitof") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("of") + 6);
jawab = jawab.Substring(0, jawab.IndexOf("?") - 0);
}
else if (msgBigBuzz.IndexOf("asdigits?") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("Whatis") + 6);
jawab = jawab.Substring(0, jawab.IndexOf("as") - 0);
}
else if (msgBigBuzz.IndexOf("whichisthesmallest?") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("bers") + 4);
jawab = jawab.Substring(0, jawab.IndexOf(",w") - 0);
string[] s = null;
s = Regex.Split(jawab, ",");
long lng = 0;
lng = long.Parse(s[s.GetLowerBound(0)]);
for (long i = s.GetLowerBound(0); i <= s.GetUpperBound(0); i++)
{
if (lng > long.Parse(s[i]))
{
lng = long.Parse(s[i]);
}
}
jawab = lng.ToString();
}
else if (msgBigBuzz.IndexOf("whichisthebiggest?") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("bers") + 4);
jawab = jawab.Substring(0, jawab.IndexOf(",w") - 0);
string[] s = null;
s = Regex.Split(jawab, ",");
long lng = 0;
lng = long.Parse(s[s.GetUpperBound(0)]);
for (long i = s.GetLowerBound(0); i <= s.GetUpperBound(0); i++)
{
if (lng < long.Parse(s[i]))
{
lng = long.Parse(s[i]);
}
}
jawab = lng.ToString();
}
else if (msgBigBuzz.IndexOf("The1stnumberof") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("of") + 2);
jawab = jawab.Substring(0, jawab.IndexOf("is?") - 0);
string[] s = null;
s = Regex.Split(jawab, ",");
jawab = s[0].ToString();
}
else if (msgBigBuzz.IndexOf("The2ndnumberof") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("of") + 2);
jawab = jawab.Substring(0, jawab.IndexOf("is?") - 0);
string[] s = null;
s = Regex.Split(jawab, ",");
jawab = s[1].ToString();
}
else if (msgBigBuzz.IndexOf("The3rdnumberof") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("of") + 2);
jawab = jawab.Substring(0, jawab.IndexOf("is?") - 0);
string[] s = null;
s = Regex.Split(jawab, ",");
jawab = s[2].ToString();
}
else if (msgBigBuzz.IndexOf("The4thnumberof") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("of") + 2);
jawab = jawab.Substring(0, jawab.IndexOf("is?") - 0);
string[] s = null;
s = Regex.Split(jawab, ",");
jawab = s[3].ToString();
}
else if (msgBigBuzz.IndexOf("The5thnumberof") != -1)
{
jawab = msgBigBuzz.Substring(msgBigBuzz.IndexOf("of") + 2);
jawab = jawab.Substring(0, jawab.IndexOf("is?") - 0);
string[] s = null;
s = Regex.Split(jawab, ",");
jawab = s[4].ToString();
}
if (jawab.Length != 0)
{
return jawab;
}
else
{
return "-1";
}
}
catch (Exception err)
{
return "-1";
}
}