[CAPITALIZE LETTER] (Contest Page | CodeChef)
C Programming Language
Given an info line, underwrite first and last letter of each word by altering into uppercase in the given line . Generate the output after alteration with the same input line given . When given that the information line is in lowercase. .
The basic algorithm is to keep track of the spaces and to capitalize the letter before space & after space. Also, the first letter and the last letter of the line should be capitalized. Few more things that need to be kept in mind such that:
- More than one occurrence of space in between two words.
- There may be word of single letter like ‘k’, which need to be capitalized.
- There may be word of two letters like ‘ok’, where both the letters need to be capitalized.
kagpil atgnth vatyu
KagpiL AtgntH VatyU
int size= 0;
else if(str[i]==’ ')