A shop sells books, maps and magazines. Every item is identified by a unique 4 - digit code. All books have a code starting with a 1, all maps have a code which starts with a 2 and all magazines have a code beginning with a 3. Code 9999 is used to end the program.
Write an algorithm using pseudocode that input the codes for all items in stock and outputs number of books, magazine and maps in stock.
Include any validation checks necessary.