5.5.1

来源:互联网 发布:人民币玩家 知乎 编辑:程序博客网 时间:2024/05/01 05:56

5.20

#include<iostream>#include<string>using namespace std;int main() {    string str, prestr;    bool twice = false;    while (cin >> str) {        if (str == prestr) {            twice = true;            break;        }        else {            prestr = str;        }    }    if (!twice) {        cout << "没有单词重复" << endl;    }    else {        cout << str << endl;    }    return 0;}
0 0
原创粉丝点击