Improve Match Counting

This commit is contained in:
Matti 2024-11-13 22:18:09 +01:00
parent c38e15ded6
commit 253a2daeac

View File

@ -87,11 +87,14 @@ int countMatches(std::vector<std::string> &v1, std::vector<std::string> &v2) {
shorterSize = v2.size();
}
std::vector<std::string> copyOfv2 = v2;
int count = 0;
for (int i = 0; i < shorterSize; i++) {
for (int j = 0; j < shorterSize; j++) {
if (v1[i] == v2[j]) {
if (v1[i] == copyOfv2[j]) {
count++;
copyOfv2[j] = "I have been counted already";
break;
}
}