#include <stdio.h>
#include <string.h>

#define SIZE 300

int main(void)
{
    char sentence[SIZE];
    char searchString[SIZE];

    printf("Enter a line of text:\n");
    fgets(sentence, SIZE, stdin);

    printf("Enter the search string:\n");
    fgets(searchString, SIZE, stdin);

    sentence[strcspn(sentence, "\n")] = '\0';
    searchString[strcspn(searchString, "\n")] = '\0';

    char *searchPtr =
        strstr(sentence, searchString);

    if (searchPtr == NULL)
    {
        printf("The search string was not found.\n");
    }
    else
    {
        printf("\nThe first occurrence is:\n");
        printf("%s\n", searchPtr);

        searchPtr =
            strstr(searchPtr + 1, searchString);

        if (searchPtr != NULL)
        {
            printf("\nThe second occurrence is:\n");
            printf("%s\n", searchPtr);
        }
        else
        {
            printf("\nThere is no second occurrence.\n");
        }
    }

    return 0;
}