My program is supposed to count in a string an entered string.
For example:
Enter a text: Hello World
Enter a string: llo
occurs 1 times in Hello World
Unfortunately, my program does not give me anything. Does anyone have a tip for me?
void aufgabe7(char string[MAX], char stringw[MAX]){
    printf("Enter a Text: \n");
    fgets(string, MAX, stdin);
    int i, j, len, len2;
    int count = 0;
    int count2 = 0;
    len = strlen(string);
    
    printf("Enter a string: \n");
    fgets(stringw, MAX, stdin);
    len2 = strlen(stringw);
    for (i = 0; i < len;)
    {
        j = 0;
        count = 0;
        while ((string[i] == stringw[j]))
        {
            count++;
            i++;
            j++;
        }
        if (count == len2)
        {
            count2++;
            count = 0;
        }
        else
            i++;
        
        
    }
    
    printf("%s occurs %d times in %s \n", stringw, count2, string);
    
}
void main (void){
    char data[MAX];
    task7(&data[0], &data[0]);
}
 
     
    