01 October 2017

uva 10260

/***
Md. Namzul Hasan
Shahjalal University of Science & Technology,Sylhet.
hasan08sust@gmail.com
***/
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<cstring>
#include<sstream>
#include<cmath>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define load(array,size)  for(int i=0 ; i<size ; i++) cin>>array[i]  ;
#define new_line  pf("\n")
#define clear_data(array) memset(array,0,sizeof(array))
#define highest_int 2147483647


int main()
{
   char str[101];

   while(gets(str)){

   for(int i=0 ; i<strlen(str) ; i++){

     if(str[i]== 'B'||str[i] =='F'||str[i] =='P'||str[i]=='V'){
          if(str[i-1]!= 'B'&&str[i-1] !='F'&&str[i-1] !='P'&&str[i-1]!='V'){
            pf("1");
          }
      }else if(str[i]== 'C'||str[i] =='G'||str[i] =='J'||str[i]=='K'||str[i] =='Q'||str[i]=='S'||str[i]=='X'||str[i]=='Z'){
        if(str[i-1]!= 'C'&&str[i-1] !='G'&&str[i-1] !='J'&&str[i-1]!='K'&&str[i-1] !='Q'&&str[i-1]!='S'&&str[i-1]!='X'&&str[i-1]!='Z'){
            pf("2");
          }
      }else if(str[i]=='D'||str[i]=='T'){
        if(str[i-1]!='D'&&str[i-1]!='T'){
            pf("3");
        }
      }else if(str[i]=='L'){
        if(str[i-1]!='L'){
            pf("4");
          }
      }else if(str[i]=='M'||str[i]=='N'){
        if(str[i-1]!='M'&&str[i-1]!='N'){
            pf("5");
          }
      }else if(str[i]=='R'){
        if(str[i-1]!='R'){
             pf("6");
          }
      }

   }

   pf("\n");

   }
    return 0;
}

No comments:

Post a Comment

UVA 10679 - I Love Strings!!