C programming Part II

What is output by the following code?

    char str[] = "The cat sat on the mat";
    int next = 0;
    for (int i = 0; i < strlen(str); i++){
        if (next) str[i] = toupper(str[i]);
        next = isspace(str[i]);
    }
    printf("%s\n", str);
 The Cat Sat On The Mat
 the Cat Sat On The Mat
 THE CAT SAT ON THE MAT
 the cat sat on the mat
 The cat sat on the mat