#P3742. Find a String z Satisfying f(x, z) = y

    ID: 16993 Type: Default 1000ms 256MiB

Find a String z Satisfying f(x, z) = y

Find a String z Satisfying f(x, z) = y

We define a function \(f(s_1,s_2)\) for two strings \(s_1\) and \(s_2\) composed of lowercase letters and having equal length. The function returns a string \(g\) of the same length such that its \(i\)th character is given by

[ g_i = \min(s_{1,i}, s_{2,i}) ]

For example,

[ f(\texttt{ab},\texttt{ba})=\texttt{aa}, \quad f(\texttt{nzwzl},\texttt{zizez})=\texttt{niwel} ]

You are given two strings \(x\) and \(y\) consisting only of lowercase letters and having the same length. Find any string \(z\) (of the same length) such that \(f(x, z)=y\). If no such string exists, output \(-1\).

inputFormat

The input consists of two lines:

  • The first line contains the string \(x\).
  • The second line contains the string \(y\).

Both \(x\) and \(y\) consist of lowercase letters and have the same length.

outputFormat

Output a string \(z\) of the same length such that \(f(x, z)=y\). If no such string exists, output \(-1\).

sample

ab
aa
aa