#include <stdio.h>
int find_min(int a,int b){
if (a > b){
return b;}
else {
return a;}}
int find_intersection_with_count(int *arr1,int *arr2,int n1,int n2){
int count1[10] = {0};
int count2[10] = {0};
int count[10] = {0};
for (int i = 0;i <= 9;i ++){
for (int j = 0;j < n1;j ++){
if(*(arr1 + j) == i){
count1[i] ++;}}
for (int j = 0;j < n2;j ++){
if(*(arr2 + j) == i){
count2[i] ++;}}
count[i] = find_min(count1[i],count2[i]);
if (count[i] != 0){
printf("%d (%d) ",i
,count
[i
]);}} for (int k = 9;k >= 0 ;k --){
if (count[k] != 0){
printf("%d (%d) ",k
,count
[k
]);}}}
int main(void) {
int n1,n2;
int arr1[n1];
for (int i = 0;i < n1;i ++){
int arr2[n2];
for (int i = 0;i < n2;i ++){
find_intersection_with_count(&arr1,&arr2,n1,n2);
return 0;}
I2luY2x1ZGUgPHN0ZGlvLmg+CmludCBmaW5kX21pbihpbnQgYSxpbnQgYil7CglpZiAoYSA+IGIpewoJCXJldHVybiBiO30KCWVsc2UgIHsKCQlyZXR1cm4gYTt9fQoJCQppbnQgZmluZF9pbnRlcnNlY3Rpb25fd2l0aF9jb3VudChpbnQgKmFycjEsaW50ICphcnIyLGludCBuMSxpbnQgbjIpewoJaW50IGNvdW50MVsxMF0gPSB7MH07CglpbnQgY291bnQyWzEwXSA9IHswfTsKCWludCBjb3VudFsxMF0gPSB7MH07Cglmb3IgKGludCBpID0gMDtpIDw9IDk7aSArKyl7CgkJZm9yIChpbnQgaiA9IDA7aiA8IG4xO2ogKyspewoJCQlpZigqKGFycjEgKyBqKSA9PSBpKXsKCQkJCWNvdW50MVtpXSArKzt9fQoJCWZvciAoaW50IGogPSAwO2ogPCBuMjtqICsrKXsKCQkJaWYoKihhcnIyICsgaikgPT0gaSl7CgkJCQljb3VudDJbaV0gKys7fX0KCQljb3VudFtpXSA9IGZpbmRfbWluKGNvdW50MVtpXSxjb3VudDJbaV0pOwoJCWlmIChjb3VudFtpXSAhPSAwKXsKCQkJcHJpbnR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