char ch[20];
string str;
// cin.get(ch ,2);
/*getline(cin,str);*/
cin.getline(ch,5);
cout << ch<<endl;
// cout << str;
统计单词个数等信息 用时要测试
typedef map<string, int> count_map;
typedef count_map::iterator count_iter;
typedef string::size_type str_size;
count_map counts;
string word;
string okay("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghigklmnopqrstuvwxyz"
"1234567890-_");
while (cin>>word)
{
string copy;
for (string::iterator w(word.begin()); w != word.end(); ++w)
{
if (okay.find(*w) != string::npos)
copy.push_back(*w);
}
if (!copy.empty())
++counts[copy];
}
str_size longest(0);
for (count_iter iter(counts.begin()); iter != counts.end();++iter)
{
if (iter->first.size() > longest)
longest = iter->first.size();
}
const int count_size(10);
for (count_iter iter(counts.begin()); iter!=counts.end(); ++iter)
{
cout << setw(longest) << left << iter->first <<
setw(count_size) << right << iter->second << endl;
}