1 #include<iostream> 2 #include<stdio.h> 3 #include<string> 4 #include<set> 5 using namespace std; 6 7 int main() 8 { 9 //freopen("acm.acm","r",stdin); 10 set<char> coll[7]; 11 12 coll[1].insert('B'); 13 coll[1].insert('F'); 14 coll[1].insert('P'); 15 coll[1].insert('V'); 16 17 coll[2].insert('C'); 18 coll[2].insert('G'); 19 coll[2].insert('J'); 20 coll[2].insert('K'); 21 coll[2].insert('Q'); 22 coll[2].insert('S'); 23 coll[2].insert('X'); 24 coll[2].insert('Z'); 25 26 coll[3].insert('D'); 27 coll[3].insert('T'); 28 29 coll[4].insert('L'); 30 31 coll[5].insert('M'); 32 coll[5].insert('N'); 33 34 coll[6].insert('R'); 35 int i; 36 int j; 37 int tem; 38 string s; 39 //set<char>::iterator pos; 40 while(cin>>s) 41 { 42 tem = -1; 43 for(i = 0; i < s.length(); ++i) 44 { 45 for(j = 1; j <= 6; ++j) 46 { 47 if(coll[j].find(s[i]) != coll[j].end()) 48 { 49 if(tem != j) 50 { 51 cout<<j; 52 tem = j; 53 } 54 break; 55 } 56 57 } 58 if(j == 7) 59 tem = -1; 60 } 61 cout<<endl; 62 } 63 64 65 66 }