let num = readline()
let arr = (+(num.split('').reverse().join('')) + '').split('') // 排除0的干扰
let sets = Array.from(new Set(arr))
console.log(sets.join(''))
let num = readline()
let arr = (+(num.split('').reverse().join('')) + '').split('') // 排除0的干扰
let sets = Array.from(new Set(arr))
console.log(sets.join(''))