讯飞笔试统计字符串的题
#include<iostream>
#include<string>
#include<vector>
#include<sstream>
using namespace std;
int main(void) {
string str;
cin >> str;
stringstream cinstr(str);
string ch;
string search("0123456789");
vector<char> vec;
int count = 0;
while (getline(cinstr,ch,',')) {
string::size_type pos=0;
if (pos = ch.find_first_not_of(search, pos) == string::npos) {
int a = ch[0] - '0';
int b = ch[ch.size() - 1] - '0';
if (a + b > 8) {
count++;
}
}
else {
continue;
}
}
cout << count << endl;
return 0;
}
#科大讯飞##笔试题目#
