Bob
using System;
using System.Text.RegularExpressions;
public static class Bob
{
public static string Response(string statement)
{
string statementmod= statement.Trim();
bool isQuestion = statementmod.EndsWith("?");
int letterCounter = Regex.Matches(statementmod,@"[a-zA-Z]").Count;
bool hasLetter = letterCounter>0;
bool hasOnlyUpper = statementmod==statementmod.ToUpper();
if (statementmod=="")
{
return "Fine. Be that way!";
}
else if(isQuestion && hasOnlyUpper && hasLetter)
{
return "Calm down, I know what I'm doing!";
}
else if(isQuestion)
{
return "Sure.";
}
else if(hasLetter && hasOnlyUpper)
{
return "Whoa, chill out!";
}
else return "Whatever.";
}
}