#include #include using namespace std; int main() { string s, t; cin >> s >> t; size_t k = 0; for (char c : s) { while (k < t.size()) { if (c == t[k]) break; ++k; } } if (k == t.size()) cout << s << endl; else cout << -1 << endl; return 0; }