1 solutions
-
0
C++ :
#include <bits/stdc++.h> using namespace std; using ll = long long; const int S = 1 << 26; ll n, res, dp; ll f[S]; string s; int main() { cin >> n >> s; for (int i = 0; i < n; i++) { dp ^= (1 << (s[i] - 'a')); if (dp == 0) res++; res += f[dp]; f[dp]++; } cout << res << '\n'; return 0; }
- 1
Information
- ID
- 127
- Time
- 1000ms
- Memory
- 1024MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By