A. Word Capitalization
time limit per test
2 secondsmemory limit per test
256 megabytesinput
standard inputoutput
standard outputCapitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word.
Note, that during capitalization all the letters except the first one remains unchanged.
Input
A single line contains a non-empty word. This word consists of lowercase and uppercase English letters. The length of the word will not exceed103.
Output
Output the given word after capitalization.
Sample test(s)
input
ApPLe
output
ApPLe
input
konjac
output
Konjac
1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 int main(void){ 5 char a[1000+10]; 6 int cnt = 0; 7 while (~scanf("%s", a)){ 8 { 9 int len = strlen(a); 10 if (a[0] >= 'a' && a[0] <= 'z') printf("%c", a[0]-32); 11 else printf("%c", a[0]); 12 for (int i = 1; i < len; ++i){ printf("%c", a[i]); 13 } 14 printf("\n"); 15 } cnt++; 16 } 17 return 0; 18 }
开始题目意思理解错了……WA了一次,这么简单的题目啊……