安迪的第一个字典 (Andy's First Dictionary,UVa10815)

题目描述:

#include<iostream>
#include<string>
#include<set>
#include<sstream>
using namespace std;

set<string> dic;
string s, buf;

int main() {
  while(cin >> s) {
    for(int i = 0; i < s.length(); i++)
      if(isalpha(s[i])) s[i] = tolower(s[i]); else s[i] = ' ';
    stringstream ss(s);
    while(ss >> buf) dic.insert(buf);
  }
    for(set<string>::iterator it = dic.begin(); it != dic.end(); ++it)
    cout << *it << "
";
  return 0;
}
原文地址:https://www.cnblogs.com/secoding/p/9490649.html