#include<iostream>
using namespace std;
int main() {
// Initialize array of 5 letters
char letters[5];
// Receive 5 letters from user
cout << "Enter 5 letters: ";
for(int i=0; i<5; i++)
cin >> letters[i];
// Print letters in reverse order
for(int i=4; i>=0; i--)
// If letter repeats in input, don't repeat on output
if(i==4 || letters[i]!=letters[i+1])
cout << letters[i];
// Print new line at end
cout << endl;
return 0;
}