WOJ1340-Easy or Hard
来源:互联网 发布:白牌照是什么意思js 编辑:程序博客网 时间:2024/06/05 02:22
This is the Fifth Problem in this contest. Maybe this is not an easy one, but I think you are clever enough to solve it. Try your best!
As is known to all, most people's name can be divided into two part, one part is the family name and the other part is the given name. In Chinese we write family name before given name, but in English we write the given name first. Now the task is below:
Given N names written in Chinese Type, you should change them into English Type.
输入格式
In the first line, there is an Integer N(1<=N<=1000), which means there are N test cases in the problem.
There are N lines followed, each contains two strings and the total length of them is less than 200. The first one is the family name and the second one is the given name.
输出格式
For each test case, you should output a line contains two strings with a space character between them, the first one is the given name and the second one is the family name. What's more, we all know that the first character of the family name and the given name should be an uppercase one and other characters should be a lowercase one, so if there are mistakes in the strings, you must correct them.
样例输入
3Zhang WeiWang LiangJingZhou Chen
样例输出
Wei ZhangLiangjing WangChen Zhou
#include<stdio.h>#include<string.h>int main(){ int i,t,j,l,n; scanf("%d",&t); char name[2][200]; for(i=0;i<t;i++){ scanf("%s %s",&name[0],&name[1]); for(j=0;j<2;j++){ l=strlen(name[j]); n=0; while(n<l){ if((n==0)&&(name[j][0]>='a')&&(name[j][0]<='z')) name[j][0]-=32; else if((n>0)&&(name[j][n]>='A')&&(name[j][n]<='Z'))name[j][n]+=32;n++;}}printf("%s %s\n",name[1],name[0]);}return 0;}
- WOJ1340-Easy or Hard
- Programmer error or hard
- 【linux】soft or hard lockup
- Trust in Online Banking: Hard to Earn, Easy to Lose
- Earn Easy $55/sale | Secret Hard Money Lenders List
- Data collection is easy. Decision making is hard.
- CRCK 1.6 (Easy can be extened to Hard)
- ustc oj 1002 Easy or not
- 一点也不“easy”的easy_install -- windows or linux?
- 374. Guess Number Higher or Lower Easy
- 1004. To Buy or Not to Buy - Hard Version (35)
- Codeforces 660C Hard Process【二分 Or 尺取】
- hard
- Make Interfaces Easy to Use Correctly and Hard to Use Incorrectly
- looks so easy while hard to do -standby in 60minutes
- Make Interfaces Easy to Use Correctly and Hard to Use Incorrectly
- Effective C++ 18. Make interfaces easy to use correctly and hard to use incorrectly
- HDU5475——An easy problem(线段树or暴力)
- sql 插入后返回主键id写法
- Android开发屏幕适配
- 理解
- Week Two
- typeof 探秘
- WOJ1340-Easy or Hard
- Kotlin:学任何语言都逃不掉流控制
- GDB简单教程
- 35. Search Insert Position&& 278. First Bad Version
- scala与java之间的集合类型转换
- 1708:校门外的树
- NOIP2016天天爱跑步(洛谷1600)
- Shell test 命令
- spring_使用CGlib 创建代理