UVA Problem 11946 (Code Number Solution) Solution

Problem Solving, UVa

 

#include <bits/stdc++.h>

#include <string.h>

using namespace std;



int main()

{

int tc,i,j;

char s[100],l;

cin>>tc;



    getchar();

  for(i=1;i<=tc;i++)

  {

    while(gets(s)!='\0')

    {

        l=strlen(s);

        if(l==0)

        {

            break;

        }

        for(j=0;j<l;j++)

        {

            if(s[j]=='3') cout<<"E";

            else if (s[j]=='0') cout<<"O";

            else if (s[j]=='1') cout<<"I";

            else if (s[j]=='4') cout<<"A";

            else if (s[j]=='9') cout<<"P";

            else if (s[j]=='8') cout<<"B";

            else if (s[j]=='5') cout<<"S";

            else if (s[j]=='7') cout<<"T";

            else if (s[j]=='2') cout<<"Z";

            else if (s[j]=='6') cout<<"G";

            else

            cout<<s[j];

        }

       

        cout<<endl;

    }

    if(i != tc)

    {

        cout<<endl;

    }



}

return 0;

}

 

0 Comments

You may find interest following article