还是getline用法
统计字符
http://www.nowcoder.com/questionTerminal/4ec4325634634193a7cd6798037697a8
include
include
include
using namespace std;
int main() {
string s, x;
while (getline(cin,s) ) {
if (s == "#") {
break;
}
getline(cin,x);
for (int i = 0; i < s.size(); ++i) {
int sum = 0;
for (int j = 0; j < x.size(); ++j) {
if (s[i] == x[j]) {
sum++;
}
}
cout << s[i] << " " << sum << endl;
}
}
return 0;
}