对inputstring进行切割,切分标志为字符串c,统计每种子串出现的次数,返回一个map对象。
map<string, int> split(string inputstring, string c) {
vector<string> result;
map<string, int> temp_map;
string::size_type pos1 = 0, pos2 = 0;
string temp;
while (pos2 < inputstring.size()) {
pos2 = inputstring.find(c, pos2);
if (pos2 == -1) {
while (pos1 <inputstring.size()) {
if (isalpha(inputstring[pos1]))
temp += tolower(inputstring[pos1]);