Please help me with some advice on completing this problem. I can print out the first letter of someone's first name, but I do not know how to go about printing out the first letter in someone's middle name or last name. Any help is greatly appreciated. My problem is getting to print out the first letter in the middle name because I have trouble getting through the first spaces and alphabet characters before the middle name. Again, any help is greatly appreciated.
#include <cs50.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main(void)
{
string s = get_string();
if (s != NULL)
{
for (int i = 0, n = strlen(s); i < n; i++)
{
if (s[i] != ' ' && isalpha(s[i]))
{
printf("%c", toupper(s[i]));
break;
}
}
for (int j = 0, n = strlen(s); j < n; j++)
{
if (s[j] == ' ' && isalpha(s[j]+1))
{
printf("%c", s[j]++);
}
}
printf("\n");
}
}