Home > other >  Inserted into the string in the location specified. In the local can run successfully, but on the oj
Inserted into the string in the location specified. In the local can run successfully, but on the oj

Time:09-20

Topic is, input two strings s1 and s2 and specify characters in any character in s1 k, the first appearance of the location of insert string s2, constitute a new string s3, and s3 output,
Input format
Input has three lines, the first line with gets input s1 string, the second line with gets input s2. The third line with % c format, enter any character k
The output format
Use puts, output s3 string
The code below
#include
#include
Int main ()
{
Char [100] s1={};
Char s2 [100]={};
Char s3 [200]={};
Char k;
Int I, t, b, n.
Gets (s1);
Gets (s2);
The scanf (" % c ", & amp; K);
T=strlen (s1);
B=strlen (s2);
for(i=0; i{
If (s1 [I]==k)
{
N=I;
break;
}
}
for(i=0; i{
S3 [I]=s1 [I];
}
Strcat (s3, s2);
For (I=b + n. i{
S3 [I]=s1 [I - b];
}
Puts (s3);
}
 have bosses can see where the
  • Related