CanYouReadThis?

sir is this the correct approach for this problem

and sir what are the mistakes

@qudsiya no this is not the correct output, please see the sample output given in the question. You have to print the whole word, not just the first letter.
Also, length of S can be upto 1000 but you have written program considering max length to be 1000 so fix that as well.