游客 Signup | Login
中文 | En

3409 - 考试二十一:字符替换(2)

输入两个字符串str1,str2,将str2中前strlen(str1)个字符替换为str1,剩下的保留,输出结果;

Input

输入个字符串,分两行输入

Output

输出一行字符串

Examples

Input

nice
beautiful girl

Output

nicetiful girl

Solution C

#include"stdio.h"
#include"stdlib.h"
#include"string.h"
int main()
{
   char str1[20],str2[50];
   int i,j;
   gets(str1);
   gets(str2);
   i=strlen(str1);
     strncpy(str2,str1,i);
   puts(str2);
   return 0;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题