fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3. #include<stdlib.h>
  4. #include<string.h>
  5. #include<ctype.h>
  6. #define ll long long
  7. #define MOD 1e9+7
  8.  
  9. int main()
  10. {
  11. int t;
  12. scanf("%d\n", &t);
  13. while (t--)
  14. {
  15. char s[85];
  16. fgets(s, 85, stdin);
  17. s[strlen(s)-1]=NULL;
  18. char *token=strtok(s, " ");
  19. char res[85][20];
  20. int pos=0;
  21. while (token!=NULL)
  22. {
  23. token[0]=toupper(token[0]);
  24. for (int i=1; i<strlen(token); ++i) token[i]=tolower(token[i]);
  25. strcpy(res[pos++], token);
  26. token=strtok(NULL, " ");
  27. }
  28. for (int i=0; i<pos; ++i) printf("%s ", res[i]);
  29. printf("\n");
  30. }
  31. }
  32.  
Success #stdin #stdout 0s 5304KB
stdin
3
   nGuYEN    vAN    naM
tRan           TRUNG hiEU
      vO le         hOA bINh
stdout
   Nguyen    van    nam 
Tran           Hieu Hieu 
      Vo Le         hoa Binh