Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int countChar(const std::string &s) {
- struct ischar {
- ischar(char x) : x(x) {}
- bool operator()(char y) const {
- if (!(isalpha(y)))
- return true;
- else
- return false;
- }
- private:
- char x;
- };
- return std::count_if(s.begin(), s.end(), ischar(y));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement