WOJ1045-Flymouse's Poor English

Flymouse's English is very poor. Therefore, he always makes some mistakes in his composition.

For example, in sentence "flymouse is poor in EnGlish but his girlfriend is good at English" are there two mistakes:


  1. Initial letter f of the first word flymouse of this sentence is not a capital letter.


  2. EnGlish's medial letter G is a capital letter.


Notice this, you can correct the mistake by the following two steps:


  1. Make the initial letter of the first word of the sentence to be capital.


  2. Make the non-initial letters of the non-first words of the sentence to be small.


You can assure that by doing this, the new sentence will be always a correct one.


For this sample, the correct form is:


Flymouse is poor in English but his girlfriend is good at English

输入格式

The first line contains a single integer t, indicating the number of test cases, followed by one line for each test case. The line for each test case contains a sentence from flymouse's composition. the length of the sentence will be not larger than 10000. For simplicity, punctuations will always be omitted.

输出格式

There should be one output line per test case containing the correct sentence.

样例输入

1
flymouse is poor in EnGlish but his girlfriend is good at English

样例输出

Flymouse is poor in English but his girlfriend is good at English


#include<stdio.h>
#include<string.h>
char s[10010];
int t;
int main(){
	int state,i,len;
	scanf("%d",&t);
	getchar();
	while(t--){
		gets(s);
		len=strlen(s);
		state=0;
		for(i=0;i<len;i++){
			if(i==0){
				if(s[i]>='a'&&s[i]<='z')
				s[i]=s[i]-'a'+'A';
			}else if(s[i]==' '){
				state=1;
				i++;
			}else if(s[i]>='A'&&s[i]<='Z')
			s[i]=s[i]-'A'+'a';			
		}
		printf("%s\n",s);
	}
	return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值