#include int main(void) { char s[10020]; while(1) { int ptr = 0; int nacteno = 0; while(1) { char c; if(scanf("%c",&c)!=1)return 0; nacteno++; /*printf("%c",c);*/ if(c=='\n')break; {if(c=='i'||c=='I')s[ptr++] = 'I';} {if(c=='v'||c=='V')s[ptr++] = 'V';} {if(c=='x'||c=='X')s[ptr++] = 'X';} {if(c=='l'||c=='L')s[ptr++] = 'L';} {if(c=='c'||c=='C')s[ptr++] = 'C';} {if(c=='d'||c=='D')s[ptr++] = 'D';} {if(c=='m'||c=='M')s[ptr++] = 'M';} } int i; int M=0,D=0,C=0,L=0,X=0,V=0,I=0,lastpos=-1; int points = 0; for(i=0;i2)break;} } int xc =0; int ix =0; if(C==3) { int ok; int j = lastpos+1; if((ok)&&(j2)break;} } } if((X==3)||xc) { int ok = 1; int j = lastpos+1; if((ok)&&(j2)break;} } } if(nacteno>1) printf("%d\n",points); } return 0; }