program RIMSKI;
var B:string;
    i,sumI,sumX:integer;
begin
     sumI:=0;
     sumX:=0;
     readln(B);
     for i:=1 to length(B) do
         if B[i]='I' then sumI:=sumI+1
         else
         if B[i]='X' then sumX:=sumX+1;
     if sumI=1 then
        if (pos('I',B)>pos('V',B)) and (pos('V',B)>0) then
           begin
                B[pos('I',B)]:='V';
                B[pos('V',B)]:='I';
           end;
     if sumX=1 then
        if (pos('X',B)>pos('L',B)) and (pos('L',B)>0) then
           begin
                B[pos('X',B)]:='L';
                B[pos('L',B)]:='X';
           end;
     writeln(B);
     readln;
end.
