Help me in solving SESO06 problem

My issue

give me correct code of this problem

My code

#include <stdio.h>

int main() {
    char str[100] = "HelloHowyoudoing"; 
    char c1 = 'H';
    int k = 2;

    int count = 0;
    int i;

    for (i = 0; str[i] != '\0'; i++) {
        if (str[i] == c1) {
            count++;
            if (count == k) {
                printf("%d\n", i + 1); // Print the position (1-based indexing)
                break; // Exit the loop after finding the k-th occurrence
            }
        }
    }

    return 0;
}

Learning course: Data structures & Algorithms lab
Problem Link: Find Kth Character Position in Data structures & Algorithms lab