九度OnlineJudge之1021:统计字符
题目描述: #include <iostream>#include <string>#include <algorithm>using namespace std;int main(){ string str1,str2; while(getline(cin,str1),str1!="#") { getline(cin,str2); for(string::iterator it1 = str1.begin();it1!=str1.end();++it1) { int k = 0; for(string::iterator it2 = str2.begin();it2!=str2.end();++it2) { if( *it1 == *it2 ) k++; } cout<<*it1<<" "<<k<<endl; } } //system("PAUSE"); return 0;}