let line = readline().split('')
let map = {}
for(let ch of line){
if(map[ch]) map[ch]++
else map[ch] = 1
}
let min = Math.min(...Object.values(map))
let result = ''
for(let i=0;i<line.length;i++){
if(map[line[i]] !== min){
result+=line[i]
}
}
console.log(result)
let map = {}
for(let ch of line){
if(map[ch]) map[ch]++
else map[ch] = 1
}
let min = Math.min(...Object.values(map))
let result = ''
for(let i=0;i<line.length;i++){
if(map[line[i]] !== min){
result+=line[i]
}
}
console.log(result)