Given a string, a character, and a count, the task is to print the string after the specified character has occurred count number of times. Print “Empty string” in case of any unsatisfying conditions. (Given character is not present, or present but less than given count, or given count completes on last index). If given count is 0, then given character doesn’t matter, just print the whole string. Examples:
Input : str = "This is demo string"
char = i,
count = 3
Output : ng
Input : str = "geeksforgeeks"
char = e,
count = 2
Output : ksforgeeks
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
This article is contributed by Sahil Chhabra. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.