#K10121. Counting Duplicate ISBN Entries
Counting Duplicate ISBN Entries
Counting Duplicate ISBN Entries
You are given one or more inventories of books, where each inventory is represented as a test case. Each inventory contains a list of ISBN numbers. Your task is to count the number of duplicate ISBN entries in each inventory. Specifically, if an ISBN appears k times (where k > 1), it contributes k - 1 to the duplicate count.
For example, if an inventory contains the ISBN sequence [9781234567897, 9781234567897, 9780544003415, 9780345816023, 9780544003415, 9780984782857], the duplicate count is 2 because 9781234567897 appears twice (contributing 1) and 9780544003415 appears twice (contributing 1).
inputFormat
The input begins with an integer T denoting the number of test cases. Each test case starts with an integer N representing the number of ISBN numbers, followed by a line of N ISBN numbers separated by spaces.
outputFormat
For each test case, output a single line containing the total count of duplicate ISBN entries. For each ISBN that occurs more than once, count each occurrence beyond the first.
## sample1
6
9781234567897 9781234567897 9780544003415 9780345816023 9780544003415 9780984782857
2
</p>