const line = readline().split("") const obj = {} line.forEach( item => { if( !obj[item] ) { obj[item] = 1 }else { obj[item] += 1 } }) const res = Object.keys( obj ).sort( ( a, b ) => { if( obj[a] === obj[b] ) { return a.charCodeAt() - b.charCodeAt() }else { return obj[b] - obj[a] } }) print( res.join("") )