#include
#include
using namespace std;
class Mystring
{
private:
string str;
int letterNum;
public:
Mystring()
{
str = "";
letterNum = 0;
}
Mystring(string s)
{
str = s;
int i=0, cnt=0;
for(i=0; i {
if(str[i]>='a'&&str[i]<='z'||str[i]>='A'&&str[i]<='Z')
cnt++;
}
letterNum = cnt;
}
string getStr()
{
return str;
}
int getNum()
{
return letterNum;
}
};
int main()
{
string str;
cout<<"input str:";
getline(cin, str);
Mystring ms(str);
cout << "str=" << ms.getStr() << endl;
cout << "字母个数:" << ms.getNum() << endl;
system("pause");
return 0;
}