Lang:G++
Edit12345678910111213141516171819#include <iostream>#include <string>using namespace std;string restore(string s1, string s2){if(s1.length() <=1) return s1;int pos = s2.find_first_of(s1[0]);return restore(s1.substr(1, pos), s2.substr(0,pos))+restore(s1.substr(pos+1), s2.substr(pos+1))+s1[0];}int main(){string s1,s2;cin>>s1>>s2;cout<<restore(s1,s2)<<endl;return 0;}