1090.大小写转换

#include<stdio.h>

#include <cstdio>

#include <iostream>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <sstream>//stringstream头文件
using namespace std;
string s,a;
bool flag;
int main()
{
while(getline(cin,s))//来自师哥的黑科技
{
flag=0;
stringstream ss(s);
while(ss>>a)
{
if(flag==1)//控制输出空格
cout<<' ';
if(a[0]>='a'&&a[0]<='z')//防止是一个数字
{
a[0]=a[0]-32;
}
cout<<a;
flag=1;
}
if(flag==1)
{
cout<<'\n';//控制输出换行符
}
}
return 0;
}

hhhh终于过了

posted @ 2018-10-21 18:43  观稳769  阅读(255)  评论(0编辑  收藏  举报