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.
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.
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.
Author: Lluís Padró
Generation: 2026-01-25T17:10:37.324Z
© Jutge.org, 2006–2026.
https://jutge.org