fork(1) download
  1. #include <iostream>
  2. #include <iterator>
  3. #include <algorithm>
  4. #include <string>
  5. using namespace std;
  6.  
  7. int main() {
  8. cout << count_if(
  9. istream_iterator<string>(cin),
  10. istream_iterator<string>(),
  11. [](const string& str) { return str.front() == str.back(); }
  12. ) << "\n";
  13. return 0;
  14. }
Success #stdin #stdout 0s 3432KB
stdin
abcdef
ababab
assssa
eeeeaa
XxxxxX
stdout
2