Help me in solving SESO06 problem

My issue

Find Kth Character Position
Given a string s1, a character c1, and an integer k, find and print the position of the
k
kth occurrence of the character c1 in the string s1. If the
k
kth occurrence does not exist, print -1.

Input Format
The first line contains the string s1, the character c1, and the integer k separated by spaces.

My code

<

Learning course: Data Structures & Algorithms using C
Problem Link: Find Kth Character Position in Data Structures & Algorithms using C