fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <algorithm>
  5. using namespace std;
  6.  
  7. int main() {
  8. vector<string> v = {"quick-brown-fox", "jumps-over", "the-lazy-dog"};
  9. int count = accumulate(v.begin(), v.end(), 0, [](int p, string s) {
  10. return p + count_if(s.begin(), s.end(), [](char c) {return c != '-';});
  11. });
  12. cout << count << endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
32