The code is pretty self-explanatory: if the input string has an even length, then all the characters it is comprised of must be present there even number of times; if the input string has an odd length, then there must be exactly one character which appears there an odd number of times, all the other must appear even number of times as well.

```
bool canPermutePalindrome(string s) {
vector<int> freqs(256, 0);
for(auto& c : s) ++freqs[c];
auto oddCnt = count_if(freqs.begin(), freqs.end(), [](int d){return d % 2;});
return (s.size() % 2) == oddCnt;
}
```