A company manufactures different types of software products. They deliver their products to their N clients. Whenever the company fulfills the complete order of a client, the orderID generated is the concatenation of the number of products delivered for every committed product type. The head of the sales team wishes to find the clientwise data for the total number of products of any type delivered to every client.
Write an algorithm for the head of sales team to calculate the total number of products of any type delivered to the respective clients.
Input
The first line of the input consists of
an
Integer numOfClients, representing
the number of clients (N).
The second line consists of N space-
orderID,....., orderlDN-
separated Integers - orderlDo 1 representing the orderIDs of the orders delivered to the clients.
Print N space-seperated integers representing the clientwise data for the total number of products of any type delivered to each of the respective clients.
20 21
Constraints
0s numOfClients s 106
Os orderID, s 106
0s1< numOfClients
Example
Input:
4
43 345 20 987
Output:
7 12 2 24
What I have tried:
Dictionary???How do I in this Question , which datastructure will be used??