You are viewing a single comment's thread. Return to all comments →
char c = str[i].at(k); alpha[c - 'a']++;
can be simplify to
alpha[str[i].at(k)-'a']++
can you explain why int alpha[26] = {0}; has to have a size when I change it to vector? vector alpha(26), without the size the program failed to run.
Gemstones
You are viewing a single comment's thread. Return to all comments →
char c = str[i].at(k); alpha[c - 'a']++;
can be simplify to
alpha[str[i].at(k)-'a']++
can you explain why int alpha[26] = {0}; has to have a size when I change it to vector? vector alpha(26), without the size the program failed to run.