Wrong Answer
Code
#include <iostream>
#include<map>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin>>n;
string str;
cin>>str;
map<char,int> freq;
for (char c : str) {
freq[c]++;
}
long long result = 0;
for (auto &p : freq) {
int count = p.second;
if (count > 1) {
result += count * (count - 1);
}
}
cout << result << endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1038 Do not touch my string
- Contest
- Brain Booster #3
- Language
- C++20 (G++ 13.2.0)
- Submit At
- 2024-05-06 17:21:46
- Judged At
- 2024-11-11 03:32:17
- Judged By
- Score
- 10
- Total Time
- 40ms
- Peak Memory
- 2.336 MiB