To run this solution, you just have to have Ruby installed.
$ls
README.md input lib output run.rb
$ruby run.rb
...(bunch of debug statements followed by the requested output)
OUTPUT
------
0001 Concourse_A_Ticketing A5 A1 : 11
0002 A5 A1 A2 A3 A4 : 9
0003 A2 A1 : 1
0004 A8 A9 A10 A5 : 6
0005 A7 A8 A9 A10 A5 BaggageClaim : 12