View Code of Problem 3924

#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main(void)
{
    char c,pre;
    int flag = 1;
    while ((c = getchar()) != '\n')
    {
        if(flag){
            pre = c;
            flag = 0;
            cout << pre;
        }else{
            if(pre != c){
                cout << c;
                pre = c;
            }
        }
    }
    cout << endl;
}

Double click to view unformatted code.


Back to problem 3924