fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int letters_counted_in_text(std::wstring const&text)
  5. {
  6. int count = 0;
  7. wstring abc = L"abcdefghijklmnñopqrstuvwxyzáéíóúABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ";
  8.  
  9. for (unsigned i = 0; i < text.length(); ++i)
  10. for (unsigned j = 0; j < abc.length(); ++j)
  11. if (text.at(i) == abc.at(j))
  12. {
  13. count++;
  14. j = abc.length();
  15. }
  16. return count;
  17. }
  18.  
  19. int main()
  20. {
  21. // your code goes here
  22. wstring test = L"Hola, cómo estás";
  23. cout << letters_counted_in_text(test);
  24.  
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
13