-
-
Save enzerr/24ccd19117b623d3d0120ccf0300243a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
#define int long long | |
using namespace std; | |
map<string, int> mp; | |
int32_t main(){ | |
ios::sync_with_stdio(false); cin.tie(0); | |
int n; cin >> n; | |
for(int i = 0; i < n; i++){ | |
string s; cin >> s; | |
map<char, int> freq; | |
for(char x : s) freq[x]++; | |
string aux; | |
for(auto[k, v] : freq) aux.push_back(v); | |
sort(aux.begin(), aux.end()); | |
mp[aux]++; | |
} | |
int ans = 0; | |
for(auto[k, v] : mp){ | |
ans += (v*v-v)/2; | |
} | |
cout << ans << '\n'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment