2 条题解

  • 0
    @ 2025-2-11 18:54:03
    ```cpp
    #include <iostream>
    #include <string>
    #include <sstream>
    #include <set>
    using namespace std;
     
    int main() {
        string line;
        getline(cin, line);          // 读取整行输入 
        istringstream iss(line);      // 创建字符串流 
        set<string> unique_words;   // 利用set自动去重和排序 
        set<string>::iterator it;
        string word;
        while (iss >> word) {         // 自动处理多个空格分割 
            unique_words.insert(word);  // 插入单词(自动去重)
        }
        
        for ( it=unique_words.begin(); it!=unique_words.end(); ++it) {
            cout << *it << endl;        // 按字典序输出 
        }
        return 0;
    }
    

    信息

    ID
    1350
    时间
    1000ms
    内存
    128MiB
    难度
    7
    标签
    (无)
    递交数
    14
    已通过
    11
    上传者