UpUp : HackerEarth Problem Solution

You are given a string SS consists of several words separated by one or more spaces. Word consists of Latin letters as well as other symbols (but not spaces).
In each word which starts from lowercase Latin letter replace starting letter with uppercase Latin letter.

Input

The only line contains S

Output

Output one line with modified string S.

Constraints

1 <= length of S <= 30 000

Sample Input:

Wish you were here

Sample Output:

Wish You Were Here

C Implementation:

#include <stdio.h>
#define MAX 1000000
int main()
{
    char *s;
    int i;
    s = (char*)malloc(sizeof(char)*MAX);
    gets(s);
    i=0;
    if(s[0]>='a' && s[0]<='z')
       s[0] = s[0] - 32;
    while(s[i])
    {
     if(s[i]==' ')
     {
      if(s[i+1]>='a' && s[i+1]<='z')
       s[i+1] = s[i+1] - 32;
     }
     i++;
    }
    printf("%s",s);
    return 0;
}