Help me in solving SESO06 problem

My issue

keep fails on first test case

My code

#include <iostream>
#include <string>
using namespace std;

int main() {
    string s1;
    char c1;
    int k;

    // Read the entire line for the string
    getline(cin, s1);
    
    // Read the character and integer k
    cin >> c1 >> k;

    int count = 0; // To count occurrences of c1
    int position = -1; // Initialize position to -1

    // Loop through the string to find occurrences
    for (int i = 0; i < s1.length(); i++) {
        if (s1[i] == c1) {
            count++;
            // Check if we've reached the k-th occurrence
            if (count == k) {
                position = i; // Update position
                break; // Exit the loop once found
            }
        }
    }

    // Output the result
    cout << position << endl;

    return 0;
}

Learning course: Design and analysis of Algorithms
Problem Link: https://www.codechef.com/learn/course/abesit-daa/ABESITDA16/problems/SESO06