Given a string S without spaces, a character ch, and an integer count, the task is to find the string after the specified character has occurred count number of times.
Input: S = "Thisisdemostring", ch = 'i',
count = 3
Explanation: Substring of S after the 3rd
occurrence of 'i' is "ng"
Input: S = "Thisisdemostri", ch = 'i',
count = 3
Output: Empty string
Explanation: 'i' occurce 3rd time at
Your task is to complete the function printString() which takes a single, a character, and a count as inputs and returns the string. You need not take any input or print anything.
Note: “Empty string” should be returned incase of any unsatisfying conditions (Given character is not present, or present but less than given count, or given count completes on the last index). If given count is 0, then given character doesn’t matter, just return the whole string.
Expected Time Complexity: O(|s|) Expected Auxiliary Space: O(1)
1 <= |S| <= 105
Assume upper case and lower case
alphabets as different