Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	index := make(map[string]string)
	keys := []string{}
	for stdin.Scan() {
		l := strings.Split(stdin.Text(), " ")
		if l[0] == "0" {
			break
		}
		if index[l[0]] == "" {
			keys = append(keys, l[0])
		}
		index[l[0]] += l[1] + " "
	}
	sort.Strings(keys)
	for _, k := range keys {
		fmt.Println(k)
		p := strings.Split(strings.TrimRight(index[k], " "), " ")
		pages := []int{}
		for _, v := range p {
			i, _ := strconv.Atoi(v)
			pages = append(pages, i)
		}
		sort.Ints(pages)
		for i, v := range pages {
			if i > 0 {
				fmt.Printf(" ")
			}
			fmt.Printf("%d", v)
		}
		fmt.Println()
	}
}

Python: dic = {}
while True:
    try:
        word, pgn = input().split()

        if word in dic.keys():
            dic[word].append(int(pgn))
        else:
            dic[word] = [int(pgn)]
    except:
        break

for k, v in dic.items():
    print(k)
    print(' '.join(map(str, sorted(v))))

Python: import sys
dictionary = {}
for i in sys.stdin.readlines():
	word, page = i.split()
	if word in dictionary:
		dictionary[word].append(int(page))
	else:
		dictionary[word] = [int(page)]
dictionary = sorted(dictionary.items()) #???????????????????????????
for i in dictionary:
	print(i[0]) #??????
	print(*sorted(i[1]))

Python: d = {}
while True:
    try:
        w, n = input().split()
        n = int(n)
        temp = d.get(w, [])
        temp.append(n)
        d[w] = temp
    except:
        key = list(d.keys())
        key.sort()
        for k in key:
            print(k)
            d[k].sort()
            for n in range(len(d[k])):
                if n != 0: print(' ', end='')
                print(d[k][n], end='')
            print('')
        break

Python: dic = {}
while True:
    try:
        word, pgn = input().split()
    except ValueError:
        break

    if word in dic.keys():
        dic[word].append(int(pgn))
    else:
        dic[word] = [int(pgn)]
for k, v in dic.items():
    print(k)
    print(' '.join(map(str, sorted(v))))

Python: book_index = {}
while True:
    try:
        word, page = input().split(' ')
        page = int(page)
        page_list = book_index.get(word)
        if page_list:
            page_list.append(page)
        else:
            book_index[word] = [page]
    except Exception:
        break

for k in sorted(book_index.keys()):
    print(k)
    print(' '.join(map(str, (sorted(book_index.get(k))))))

Python: D = {}
for line in open(0).readlines():
    w, p = line.split()
    D.setdefault(w, []).append(int(p))
for k, v in sorted(D.items()):
    print(k)
    print(*sorted(v))

Python: #!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit
from collections import defaultdict


def main():
    index = defaultdict(list)

    for line in stdin:
        word, page = line.split()
        index[word].append(int(page))

    for word in sorted(index):
        print(word)
        print(*sorted(index[word]))
    exit()


if __name__ == '__main__':
    main()

Python: d = {}
while True:
    try:
        w, n = input().split()
        n = int(n)
        if w in d: d[w].append(n)
        else: d[w] = [n]
    except:
        for k in sorted(d):
            print(k)
            print(" ".join(map(str,sorted(d[k]))))
        break

Python: result = {}
while True:
    try: n = input()
    except: break
    word, number = n.split()
    if word in result:
        result[word].append(number)
    else:
        result[word] = [number]
    
for k, v in sorted(result.items()):
    val = sorted(list(map(int, v)))
    print(k + '\n' + ' '.join(map(str, val)))

Python: dic = {}

while(1):
    try:
        key,word = (x for x in input().split())
        dic.setdefault(key, [])
        dic[key].append(word)
    except:
        break

for k in sorted(dic.keys()):
    print(k)
    arr = sorted(dic[k],key=int)
    for i in range(0,len(arr)):
        if i != 0:
            print(" ",end="")
        print(arr[i],end="")
    print()

Python: import sys
def line():return sys.stdin.readline().strip()

I = {}
while True:
    try:
        a,b = line().split()
        b = int(b)
        if a in I:
            I[a].append(b)
        else:
            I[a] = [b]
    except:
        break
for k in sorted(I):
    print(k)
    print(" ".join(map(str,sorted(I[k]))))

Python: d = dict()
while True:
    try:
        w, n = input().split()
    except:
        break
    n = int(n)
    if d.get(w):
        d[w].append(n)
    else:
        d[w] = []
        d[w].append(n)

for k in sorted(d.keys()):
    print(k)
    print( *sorted(d[k]) )

Python: import sys
dic = {}
for s in sys.stdin:
    arr = s.split()
    if arr[0] in dic:
        a = dic[arr[0]]
        dic[arr[0]] = a + [int(arr[1])]
    else:
        dic[arr[0]] = [int(arr[1])]
for i in sorted(dic):
    print(i)
    a = sorted(dic[i])
    for j in range(len(a)):
        if j != len(a)-1:
            print(a[j], end=" ")
        else:
            print(a[j])

Python: #!/usr/bin/env python3

d = {}
while True:
    try:
        w, p = input().split()
    except:
        break

    try:
        d[w].add(int(p))
    except:
        d[w] = set()
        d[w].add(int(p))

l = list(d.keys())
l.sort()
for i in l:
    print(i)
    a = list(d[i])
    a.sort()
    print(" ".join(map(str, a)))

Python: d = {}
while True:
    try:
        word, page = input().split()
        page = int(page)
    except:
        break
    d[word] = [page] if word not in d else d[word] + [page]
for word, pages in sorted(d.items()):
    print(word)
    print(*sorted(pages))

Python: import sys

dic = {}
while True:
	try:
		a,b = map(str,input(),split())
		page = int(b)

		if a not in dic:
			dic[a] = [page]
		else:
			dic[a].append(page)
			
	except EOFError:
		sorted(dic.keys())
		names = list(dic.keys())
		for i in range(len(names)):
			print(names[i])
			for j in range(len(dic[i])):
				if j == len(dic[i])-1:
					print(dic[i][j])
				else:
					sys.stdout.write(dic[i][j])
		break

Python: import sys
d={}
for e in sys.stdin:
 k,v=e.split()
 d.setdefault(k,[]).append(int(v))
for k in sorted(d):
 print(k)
 print(*sorted(d[k]))

Python: book = {}
while True:
    try:
        w, n = input().split()
        w = str(w).lower()
        n = int(n)
        if (w not in book.keys()):
            book[w] = [n]
        else:
            book[w] += [n]
    
    except EOFError:
        break
    
W = []
for w, nlist in book.items():
    nlist.sort()
    W.append(w)
W.sort()
for w in W:
    print(w)
    print(*book[w])

Python: d = {}
while True:
    try:
        data = input().split()
    except:
        break
    word = data[0]
    number = int(data[1])
    if word in d:
        d[word].append(number)
    else:
        d[word] = [number]

for k, v in sorted(d.items(), key=lambda x: x[0]):
    print(k)
    print(*sorted(v))

Python: dic = {}
while 1:
    try:
        word, page = map(str, input().split())
        page = int(page)
        if word in dic:
            dic[word].append(page)
        else:
            dic[word] = [page]
    except:
        break

for d in sorted(dic):
    print(d)
    print(' '.join(map(str, sorted(dic[d]))))

Python: dic = {}
while True:
    try:
        word, pgn = input().split()
    except:
        break

    if word in dic.keys():
        dic[word].append(int(pgn))
    else:
        dic[word] = [int(pgn)]
for k, v in dic.items():
    print(k)
    print(' '.join(map(str, sorted(v))))

Python: book = {}
while 1:
    try:
        s, n = input().split()
        book.setdefault(s, []).append(int(n))
    except:
        break

book = dict(sorted(book.items()))

for k, v in book.items():
    print(k)
    v.sort()
    print(*v)