Try
#include <iostream>
#include <string_view>
#include <cctype>
using namespace std;
class Foo
{
int lco, uco;
public:
Foo(std::string_view s):lco{},uco{}
{
for (const auto & c : s)
islower(c) ? ++lco : isupper(c) ? ++uco : 0;
}
int lower(){return lco;}
int upper(){return uco;}
};
int main()
{
std::string_view test{ "The quick Brown Fox" };
Foo f(test);
std::cout << "Original String: " << test << endl;
std::cout << "No. of Upper case characters: " << f.upper() << endl;
std::cout << "No. of Lower case characters: " << f.lower() << endl;
}