Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string norm(string s) {
- string res;
- for (char &c : s) {
- if (isalnum(c) || c == '_')
- if (!reg && isalpha(c))
- res += tolower(c);
- else
- res += c;
- else
- if (!res.empty() && res.back() != ' ')
- res += ' ';
- }
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement