fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. string a;
  6. while(cin>>a){
  7. if(a=="I")cout<<"I ";
  8. if(a=="II")cout<<"II ";
  9. if(a=="III")cout<<"III ";
  10. if(a=="IIII")cout<<"IV "; // редкое но допустимое написание
  11. if(a=="IV")cout<<"IV ";
  12. if(a=="V")cout<<"V ";
  13. }
  14. // your code goes here
  15. return 0;
  16. }
Success #stdin #stdout 0s 15232KB
stdin
I II tesIt III IV V VI X test V
stdout
I II III IV V V