hdu 5082 Love(字符串处理)
来源:互联网 发布:侠女灵襄 知乎 编辑:程序博客网 时间:2024/05/21 08:45
Love
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 874 Accepted Submission(s): 535
Problem Description
There is a Love country with many couples of Darby and Joan in it. In order to commemorate their love, they will do some thing special when giving name to their offspring.
When a couple want to give name to their offspring, they will firstly get their first names, and list the one of the male before the one of the female. Then insert the string “small” between their first names. Thus a new name is generated. For example, the first name of male is Green, while the first name of the female is Blue, then the name of their offspring is Green small Blue.
You are expected to write a program when given the name of a couple, output the name of their offsping.
When a couple want to give name to their offspring, they will firstly get their first names, and list the one of the male before the one of the female. Then insert the string “small” between their first names. Thus a new name is generated. For example, the first name of male is Green, while the first name of the female is Blue, then the name of their offspring is Green small Blue.
You are expected to write a program when given the name of a couple, output the name of their offsping.
Input
Multi test cases (about 10), every case contains two lines.
The first line lists the name of the male.
The second line lists the name of the female.
In each line the format of the name is [given name]_[first name].
Please process to the end of file.
[Technical Specification]
3≤ the length of the name ≤ 20
[given name] only contains alphabet characters and should not be empty, as well as [first name].
The first line lists the name of the male.
The second line lists the name of the female.
In each line the format of the name is [given name]_[first name].
Please process to the end of file.
[Technical Specification]
3
[given name] only contains alphabet characters and should not be empty, as well as [first name].
Output
For each case, output their offspring’s name in a single line in the format [first name of male]_small_[first name of female].
Sample Input
Jim_GreenAlan_Blue
Sample Output
Green_small_Blue
代码:
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>using namespace std;int main(){ char a[25],b[25]; while(~scanf("%s",a)) { scanf("%s",b); int len=strlen(a),len1=strlen(b); int i,j; for(i=0;i<len;i++) if(a[i]=='_') break; for(j=0;j<len1;j++) if(b[j]=='_') break; for(int l=i+1;l<len;l++) printf("%c",a[l]); printf("_small_"); for(int l=j+1;l<len1;l++) printf("%c",b[l]); printf("\n"); } return 0;}
0 0
- hdu 5082 Love(字符串处理)
- HDU 5082 Love
- hdu 5082 Love(模拟)
- HDU 5082 Love
- HDU 5082 Love
- 【HDU 5082】【水题】Love
- HDU-2816 I Love You Too【字符串】
- HDU-#4730 We Love MOE Girls(字符串)
- hdu 4730 We Love MOE Girls(字符串:水题)
- hdu 4730 We Love MOE Girls【简单字符串】
- 字符串DP——HDU 6017 Girls Love 233
- hdu 5082 Love(Bestcoder Round #15)
- HDU 5082/BC 15A Love
- HDU-1039 字符串处理
- hdu 1062 字符串处理
- hdu 1048 字符串处理
- hdu 1062 字符串处理
- hdu 1106 字符串处理
- ligerui设置页签项标题setHeader方法的使用
- 微服务架构下的数据一致性:概念及相关模式
- 开始iOS 7中自动布局教程(一)
- Android 方法数超过64k限制的解决办法
- JS经验
- hdu 5082 Love(字符串处理)
- 移动端实现图片压缩上传
- java学习路线
- sass基础
- Day one
- java 压缩文件
- springmvc-hibernate配置
- 从汉诺塔到递归的探索和疑问
- (翻译)开始iOS 7中自动布局教程(二)