fork download
  1. #include <iostream>
  2. #include <regex>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. // your code goes here
  8. int count=0;
  9. wstring txt=L"Hola, cómo estás";
  10. //wstring txt=L""
  11. wregex rx( L"[a-zA-ZñÑáéíóúÁÉÍÓÚ]" );
  12. for( wsregex_iterator it( txt.cbegin(), txt.cend(), rx ); it!=wsregex_iterator();
  13. ++it ) count++;
  14. cout << count << endl;
  15. return 0;
  16. }
Success #stdin #stdout 0s 16160KB
stdin
Standard input is empty
stdout
13