this code is working but when i haven't used (::) before islower and isupper it didn't worked and i have seen this method in the first answer in this link How make separate functions to count no. of uppercase, lowercase, spaces and special characters? C++
and i want to know what is the difference between global isupper and the one in std `
string x;
cin >> x;
if(1 <= x.length() && x.length() <= 100){
int lower, upper;
lower = count_if(x.begin(), x.end(), ::islower);
upper = count_if(x.begin(), x.end(), ::isupper);
if(upper > lower)
for_each(x.begin(), x.end(), [](char& i){i = toupper(i);});
else
for_each(x.begin(), x.end(), [](char& i){i = tolower(i);});
cout << x;
}
`