fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. bool check(char c){
  4. return (c=='a'|| c=='e'|| c=='i'|| c=='o'|| c=='u');
  5. }
  6. int count (string s){
  7. unordered_set<char>h;
  8. int i,n=s.length(),c=0;
  9. for(i=0;i<n;i++)
  10. h.insert(s[i]);
  11. for(auto x:h)
  12. if(check(x))
  13. c++;
  14. return c;
  15. }
  16. int main() {
  17. // your code goes here
  18. string s= "aeiousjsksksks";
  19. int x= count(s);
  20. cout<<x;
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 5436KB
stdin
Standard input is empty
stdout
5