http://acm.hdu.edu.cn/showproblem.php?pid=2026
1 #include<iostream> 2 #include<stdio.h> 3 #include<math.h> 4 #include<string.h> 5 #include<stdlib.h> 6 using namespace std; 7 8 int main() 9 { 10 //freopen("in.txt","r",stdin); 11 char a; 12 int count=0; 13 while(~scanf("%c",&a)) 14 { 15 if(a==' ') 16 { 17 count=0; 18 printf(" "); 19 continue; 20 } 21 else if(a==' ') 22 count=0; 23 if(a>='a' && a<='z' && count==0) 24 { 25 a-=32; 26 count=1; 27 } 28 printf("%c",a); 29 } 30 return 0; 31 }