fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <cctype>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. int c[4] = {0}; // {D, U, L, S}
  9. string p;
  10.  
  11. cout << "KS: ";
  12. getline(cin, p);
  13.  
  14. for (char x : p)
  15. (isdigit(x)) ? c[0]++ : (isupper(x)) ? c[1]++ : (islower(x)) ? c[2]++ : c[3]++;
  16.  
  17. cout << "T:" << p.length() << " D:" << c[0] << " U:" << c[1] << " L:" << c[2] << " S:" << c[3] << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0s 5308KB
stdin
AHha66^^^
stdout
KS: T:9 D:2 U:2 L:2 S:3