fork download
  1. #include <iostream>
  2. #include <cctype>
  3. using namespace std;
  4.  
  5. int main() {
  6. string s;
  7. int hurufBesar = 0, hurufKecil = 0, angka = 0, simbol = 0;
  8. getline(cin, s);
  9.  
  10. for (char c : s) {
  11. if (isupper(c)) hurufBesar++;
  12. else if (islower(c)) hurufKecil++;
  13. else if (isdigit(c)) angka++;
  14. else simbol++;
  15. }
  16.  
  17. cout << "Huruf Besar: " << hurufBesar << endl;
  18. cout << "Huruf Kecil: " << hurufKecil << endl;
  19. cout << "Angka: " << angka << endl;
  20. cout << "Simbol: " << simbol << endl;
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 5316KB
stdin
dolar10N*
stdout
Huruf Besar: 1
Huruf Kecil: 5
Angka: 2
Simbol: 1