Bank accounts X59374


Statement
 

pdf   zip

thehtml

A bank account number is a sequence of 20 digits. The first four correspond to the code of the bank, the next four to the code of the office, followed by two control digits, and finally ten digits corresponding to the account number in that bank and office.

Write a program that given a list of bank account numbers, groups them by the bank they belong to, and produces a sorted list of banks, and for each bank, the total number of accounts and the list of those accounts, also sorted.

Input

The input is a sequence of bank account numbers, each of exactly 20 digits. You can assume there are no duplicate accounts in the list.

Output

The output is a sorted list of bank codes. For each bank code, the total number of accounts in that bank followed by a sorted list of account numbers is given. Follow the format in the examples.

Public test cases
  • Input

    21000924509346087124
    01129090843246676765
    21002398382010141311
    21006325234524234534
    23120988009099091341
    23123566898809991420
    41016420767778101143
    01129800131444123520
    

    Output

    0112: 2
         9090-84-3246676765
         9800-13-1444123520
    2100: 3
         0924-50-9346087124
         2398-38-2010141311
         6325-23-4524234534
    2312: 2
         0988-00-9099091341
         3566-89-8809991420
    4101: 1
         6420-76-7778101143
    
  • Information
    Author
    Lluís Padró
    Language
    English
    Official solutions
    Python
    User solutions
    Python