In any line, indexing always starts from 0. Suppose we have lines obsessed with it, then its indexing will be as follows:
geeks 0 1 2 3 4
Input: Geek i = 1 Output: Gek Input: Peter i = 4 Output: Pete
Approach: strong> from the given line, the i-th indexed element must be removed. So, split the string into two halves, before the indexed character and after the indexed character. Return the concatenated string.
Below is the implementation of the above approach: