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