Let’s say I have this string, “Hello User P “, I would like to replace the “P” with just one “$”, so it should be “Hello User $”.
If its “Hello User P”, it should be “Hello User $”.
It should just replace only the third occurrence of a string or character not others.
Below is the sample input and output format:
Input: Hello User P
Output: Hello User $