我一直觉得char[]和string混用不是太好,
sscanf 和那个什么类有点类似,熟悉程度不同而已
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cctype>
#include <algorithm>
#include <cmath>
using namespace std;
///
#define INF 0xffffff7
#define maxn 1000
int n;
map<string, int> beauties;
char lines[10086];
char temp[99];
int main()
{
///
int i, j;
cin >> n;
cin.get();
int nLines = n;
while (nLines--)
{
cin.getline(lines, sizeof(lines));
sscanf(lines, "%s", temp);
string country(temp);
beauties[country]++;
}
map<string, int>::const_iterator map_it = beauties.begin();
while (map_it != beauties.end())
{
cout << map_it ->first << " " << map_it->second << endl;
++map_it;
}
///
return 0;
}