// FixWords.cpp : 此文件包含 "main" 函數。程序執行將在此處開始並結束。
//
#include "pch.h"
#include <iostream>
using namespace std;
int main() {
char c;
int state = 0;
char end = '\0';
while (cin >> c) {
switch (state)
{
case 0:
if (c == end) {
state = 1;
}
break;
case 1:
if (c == end) {
state = 2;
}
else state = 3;
break;
case 2:
if (c != end) {
state = 3;
}
else {
state = 4;
}
break;
case 3:
if (c == end) {
state = 4;
}
else state = 0;
break;
case 4:
if (c != end) {
state = 0;
}
}
if (state != 2 && state != 4) {
cout << c;
}
end = c;
}
}