题目描述
不借用任何字符串库函数实现无冗余地接受两个字符串,然后把它们无冗余的连接起来。
输入描述:
每一行包括两个字符串,长度不超过100。
输出描述:
可能有多组测试数据,对于每组数据, 不借用任何字符串库函数实现无冗余地接受两个字符串,然后把它们无冗余的连接起来。 输出连接后的字符串。
输入例子:
abc def
输出例子:
abcdef
AC code:
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<map>
#include<math.h>
#include<string.h>
#include<queue>
#include<vector>
#include<set>
#define LL long long
#define exp 1e-9
#define MAXN 1000010
using namespace std;
void Mystrcat(char s1[],char s2[])
{
int i,j,len1,len2;
char s3[222]="";
i=j=0;
while(s1[i]!='\0')
{
s3[j]=s1[i];
i++;
j++;
}
i=0;
while(s2[i]!='\0')
{
s3[j]=s2[i];
i++;
j++;
}
s3[j]='\0';
puts(s3);
}
int main()
{
// freopen("D:\\in.txt","r",stdin);
char s1[111],s2[111];
while(scanf("%s%s",&s1,&s2)!=EOF)
{
Mystrcat(s1,s2);
}
}