统计货物
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
仓库清仓大甩卖, 给你一些货物出仓的记录, 你需要统计每种货物出单了多少次. 每种货物用一个字符串表示, 你需要按照货物的字典序输出你的统计结果.
输入格式
第一行输入一个整数n (1≤n≤100000)
接下来n 行每行输入一个字符串与一个整数
S cnt
表示货物S卖出了cnt件
其中S由小写字母构成, 长度不超过10
1≤cnt≤100
输出格式
第一行输出一个整数m表示卖出货物的种类数
接下来m行按照字典序每行输出一个字符串与一个整数表示某种货物一共卖出的数量
5
bcde 5
abc 4
bcde 5
efg 10
abc 10
3
abc 14
bcde 10
efg 10