So I wrote my code for initials and when I test it myself everything runs perfectly, but when I check it using check50 2015.fall.pset2.initials initials.c the checking program says that I have the expected output, but with extra \ns. For example:
:( outputs "MB" for "Milo Banana" \ expected output, but not "-\n\"\n"
:( outputs "MB" for "milo banana" \ expected output, but not "M\nB\n"
:( outputs "RTB" for "Robert Thomas Bowden" \ expected output, but not "2\n4\n\"\n"
and so on. This is my code, if anyone could tell me what the problem is with it and why it doesn't check out perfectly that would be great!
include
include
include
int main(void) { string s = GetString();
if (s != NULL)
{
printf("%c\n", (s[0]) - ('a' - 'A'));
for (int i = 0; i <= strlen(s); i++)
{
if (s[i] == ' ')
{
printf("%c\n", (s[i + 1]) - ('a' - 'A'));
}
}
}
}