Website Summary Files Commits Branches @commit @diff @stats
path: root / Week06 / Exercise04.cpp
blob: c7a490e23f28a30719450e7ee25fe18ba531be65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>

int main() {
	const unsigned int SIZE_FIRST = 15, SIZE_SECOND = 5;
	int first[SIZE_FIRST], second[SIZE_SECOND];

	for (unsigned int i = 0; i < SIZE_FIRST; i++)
		std::cin >> first[i];
	for (unsigned int i = 0; i < SIZE_SECOND; i++)
		std::cin >> second[i];

	unsigned int counts[SIZE_SECOND] = { 0 };
	for (unsigned int i = 0; i < SIZE_FIRST; i++) {
		for (unsigned int j = 0; j < SIZE_SECOND; j++) {
			if (first[i] == second[j]) {
				counts[j]++;
				break;
			}
		}
	}

	for (unsigned int i = 0; i < SIZE_SECOND; i++)
		std::cout << counts[i] << ' ';
	std::cout << std::endl;

	return 0;
}