package test.insertchar;
import java.util.Scanner;
public class insertChar {
public static void insertchar(String str1,String str2,int location){
if(location >str1.length() || location<0 ){
System.out.println("error");
return;
}
StringBuffer sb = new StringBuffer(str1); //insert()从0开始数
sb.insert(location,str2); //location 为3时 第一个字符插入到原字符串的第四个位置上
/**abd d //str1 可以有空格
ada //str2
3 //location
abdada d //运行结果
abc de f
987
4
abc 987de f
*/
System.out.println(sb);
}
public static void main(String args[]){
Scanner sc =new Scanner(System.in);
String str1=sc.nextLine(); //源字符串
String str2=sc.nextLine(); //要插入的字符串
int location=sc.nextInt();
insertchar(str1,str2,location);
}
}