1 solutions
-
0
C++ :
#include <bits/stdc++.h> using namespace std; string dfs(string s1,string s2){ int len = s1.size(); if (len <= 1) { return s1; } string root = s2.substr(len-1); int p = s1.find(root); return root + dfs(s1.substr(0,p),s2.substr(0,p)) + dfs(s1.substr(p + 1),s2.substr(p,len-p-1)); } int main(){ string s1,s2; cin >> s1 >> s2; cout << dfs(s1,s2); return 0; }
- 1
Information
- ID
- 353
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 10
- Tags
- # Submissions
- 3
- Accepted
- 2
- Uploaded By