let main = (input) => {
    let usrInput = input.split(/\n/)
    let uniqueArr = {}
    usrInput.map(function (item) {
        if (item in uniqueArr) {
            uniqueArr[item].count++
        } else {
            uniqueArr[item] = {
                key: item,
                count: 1
            }
        }
    })

    for (let key in uniqueArr){
        console.log(uniqueArr[key].key+" x "+uniqueArr[key].count)
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))