#include <iostream>
#include <cctype> // untuk fungsi isdigit, isupper, islower
using namespace std;
int main() {
string password;
int digitCount = 0, upperCount = 0, lowerCount = 0, symbolCount = 0;
// Membaca input kata sandi dari pengguna
cout << "Masukkan kata sandi: ";
getline(cin, password);
// Menghitung jumlah karakter
for (char c : password) {
if (isdigit(c)) {
digitCount++;
} else if (isupper(c)) {
upperCount++;
} else if (islower(c)) {
lowerCount++;
} else {
symbolCount++;
}
}
// Menampilkan hasil
cout << "Jumlah angka: " << digitCount << endl;
cout << "Jumlah huruf kapital: " << upperCount << endl;
cout << "Jumlah huruf kecil: " << lowerCount << endl;
cout << "Jumlah simbol: " << symbolCount << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y2N0eXBlPiAvLyB1bnR1ayBmdW5nc2kgaXNkaWdpdCwgaXN1cHBlciwgaXNsb3dlcgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewogICAgc3RyaW5nIHBhc3N3b3JkOwogICAgaW50IGRpZ2l0Q291bnQgPSAwLCB1cHBlckNvdW50ID0gMCwgbG93ZXJDb3VudCA9IDAsIHN5bWJvbENvdW50ID0gMDsKCiAgICAvLyBNZW1iYWNhIGlucHV0IGthdGEgc2FuZGkgZGFyaSBwZW5nZ3VuYQogICAgY291dCA8PCAiTWFzdWtrYW4ga2F0YSBzYW5kaTogIjsKICAgIGdldGxpbmUoY2luLCBwYXNzd29yZCk7CgogICAgLy8gTWVuZ2hpdHVuZyBqdW1sYWgga2FyYWt0ZXIKICAgIGZvciAoY2hhciBjIDogcGFzc3dvcmQpIHsKICAgICAgICBpZiAoaXNkaWdpdChjKSkgewogICAgICAgICAgICBkaWdpdENvdW50Kys7CiAgICAgICAgfSBlbHNlIGlmIChpc3VwcGVyKGMpKSB7CiAgICAgICAgICAgIHVwcGVyQ291bnQrKzsKICAgICAgICB9IGVsc2UgaWYgKGlzbG93ZXIoYykpIHsKICAgICAgICAgICAgbG93ZX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