This is a simple problem to work with but I get surprised at the simple optimisation that people miss in problems like this. Let's take a look at the code first:
for (int index = 0; index < input.Length - 1; index++)
{
if (input.Substring(index, 2) == "aa")
{
count++;
}
}
And that's it - a simple solution to a simple problem. Did you notice the problem optimisation though? We know that the length of our test string is 2, so the last place that the match can start is the second off last letter; hence the reason we take 1 off the Length. If the text we were trying to match against was three characters, we would take 2 off the length, and so on.