include<stdio.h>
int main()
{
int happy=0,sad=0,unhappy=0,a=0,b=0;
char op;
while((op=getchar())!='$'){
if(sad&&!happy){
sad--;
printf("-");
}
else{
if(unhappy&&!happy){
unhappy--;
printf("-");
}
else{
if(happy) happy--;
switch(op)
{
case 'T':printf("D");a++;sad=2;break;
case 'C':printf("!");b++;happy=2;break;
case 'X':printf("U");unhappy=1;break;
}
}
}
}
printf("
");
printf("%d",7a-3b);
return 0;
}