1 solutions
-
0
C :
#include<stdio.h> #include<string.h> int main(){ char s[40]; char t[40]; gets(t); gets(s); char r[80]; int pos; scanf("%d",&pos); int i=0,j=0; while(s[i]!='\0'&&i<pos) { r[i]=s[i]; i++; } while(t[j]!='\0') { r[i+j]=t[j]; j++; } while(s[i]!='\0') { r[i+j]=s[i]; i++; } r[i+j]='\0'; puts(r); /*int i; for(i=strlen(str)-1;i>=0;i--) { printf("%c",str[i]); } printf("\n"); return 0; */ return 0; }
C++ :
#include<iostream> #include<string> using namespace std; int main(){ int n; string s,t; while(cin>>s&&cin>>t&&cin>>n){ t.insert(n,s); cout<<t<<endl; } return 0; }
- 1
Information
- ID
- 10142
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By