#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int x, i;

int main(){
    string str;
    getline(cin, str, '\n');
    if(str.size()>1)
        for(int i=str.size()-1; i>0; i--){
            if(str[i]=='I' and str[i-1]!='I' and str[i-1]!='L' and str[i-1]!='C' and str[i+1]!='I'){
                swap(str[i], str[i-1]);
                i--;
            }
            if(str[i]=='X' and str[i-1]!='X' and str[i-1]!='I' and str[i+1]!='X'){
                swap(str[i], str[i-1]);
                i--;
            }
    }
    if(str=="LIX") str="XLI";
        
    
    cout << str << endl;  

    //system("pause");
    return 0;
}
