贴代码
#include
#include
using namespace std;
int main(){
string str;
getline(cin, str);
int count = 0;
int end = str.length() - 1;
while (end >= 0 && str[end] != ' ')
{
end--;
count++;
}
cout << count;
return 0;
}
2.计算某字符出现次数
#include
#include
using namespace std;
int main(){
string str;
char s;
int count = 0;
getline(cin, str);
cin >> s;
if(s > 64)
{
for (int i = 0; i < str.length(); i++)
{