In this loop, you are doing completely wrong thing. Probably, you meant to do something like
for (i = 0; i <= aaa.Length-1; i++)
Besides, in all those expressions
Substring(5, 4)
or
Substring(9, 4)
nothing guarantees that the string you are using has any characters at index 5 or 9, or has enough characters after this index to get a slice. You need to check it up before taking a substring.
The whole idea of using
immediate constants like 9, 5, or 4 is really bad; it makes the code purely maintainable.
As to your bugs, these problems are very basic, so, instead of asking anyone to fix them, you should learn how to debug them yourself. Such problems are the most easy to solve. Use the debugger, learn how to use it well, and you will be able to debug such problems in no time.
—SA