Arrays and/or dictionary would also work but they wouldn't necessarily be much faster due to the nature of the input data and the required output.

WBD