Hello
Try using COUNTIFS, for example with your sample file:

Formula: copy to clipboard
=COUNTIFS(Input!$B$2:$B$8,$A2,Input!$C$2:$C$8,B$1)


B2:C5 on the 'Output' Sheet.

Hope this helps.
DBY