- 字符串的
+
操作 for
循环的使用
#include<iostream>
#include<vector>
#include <cmath>
#include <iomanip>
using namespace std;
long long n;
int main() {
cin >> n;
vector<string>vecStr;
for (size_t i = 0; i < n; i++)
{
string str, fullStr;
for (size_t j = 0; j < 8; j++)
{
cin >> str;
fullStr += str;
}
vecStr.push_back(fullStr);
}
for (size_t i = 0; i < n; i++)
{
long long times = 1;
for (size_t j = 0; j < i; j++)
{
if (vecStr[i] == vecStr[j])
{
times++;
}
}
cout << times << endl;
}
return 0;
system("pause");
}