Quick actions

cmd+k|ctrl+k

Navigation

Languages

CppPrimer_ex5_21

Snippet info

Language

Cpp

Visibility

public

Author

legacy-v1-32

Created

2017-01-04T12:59:51Z

Updated

2017-01-05T01:59:05Z

#include <iostream>
using namespace std;

int main() {
    string s1,old;
    
    while(cin>>s1) {

        if (old==s1) 
            break;
        else 
            old = s1;
    }
    
    if (s1 != old && cin.eof()) cout << "no repeated." << endl;
    else cout << s1 << " occurs twice in succession." << endl;
    
    return 0;
}
INFO