1662: 串-插入子串
金币值:2
定数:6
时间限制:1.000 s
内存限制:128 M
正确:17
提交:44
正确率:38.64% 命题人:
题目描述
在主串S中的第pos(1<=pos<=strlen(S)+1)个位置之前插入一个子串T。
【友情提醒】由于gets函数存在安全隐患,gets已从C++14及更高版本中移除。可以使用#define gets(S) fgets(S,sizeof(S),stdin)作为兼容性宏替换。
输入格式
第1行输入一个主串S
第2行输入一个子串T
第3行输入一个整数表示在主串中插入的位置pos
第2行输入一个子串T
第3行输入一个整数表示在主串中插入的位置pos
输出格式
第1行输出插入之后的主串S
输入样例 复制
abcdefg
hi
4
输出样例 复制
abchidefg
提示
#include <stdio.h> #include <string.h> void strInsert(char s[], char t[], int pos); int main(void) { char s[81],t[81]; int p; scanf("%s",s); scanf("%s",t); scanf("%d",&p); strInsert(s,t,p); printf("%s",s); return 0; } void strInsert(char s[], char t[], int pos) { }