//\\__ hr1212 __//\\
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mi;
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define nl printf("\n");
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define f(i,a,b) for(i=a;i<b;i++)
#define rf(i,a,b) for(i=a;i>=b;i--)
#define clr(x,a) memset(x,a,sizeof(x))
#define MAX 1000100
#define MOD 1000000007
int n,m;
map<char,int> mm;
int main(){
int r,k,i,c=0,x=0,y=0,j,t,l,z,x1=0,y1=0;
ll ans=0;string p;
mm['B']=mm['F']=mm['P']=mm['V']=1;
mm['C']=mm['G']=mm['J']=mm['K']=mm['Q']=mm['S']=mm['X']=mm['Z']=2;
mm['D']=mm['T']=3;
mm['L']=4;
mm['M']=mm['N']=5;
mm['R']=6;
while(cin>>p){
c=0;
string s;
f(i,0,p.size())
if(mm.find(p[i])!=mm.end())
s+=(mm[p[i]]+'0');
else if(s.size()!=0){
f(j,0,s.size()){
while(s[j]==s[j+1] && j+1<s.size())
j++;
cout<<s[j];
}
s.clear();
}
if(s.size()!=0){
f(j,0,s.size()){
while(s[j]==s[j+1] && j+1<s.size())
j++;
cout<<s[j];
}
s.clear();
}
nl;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mi;
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define nl printf("\n");
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define f(i,a,b) for(i=a;i<b;i++)
#define rf(i,a,b) for(i=a;i>=b;i--)
#define clr(x,a) memset(x,a,sizeof(x))
#define MAX 1000100
#define MOD 1000000007
int n,m;
map<char,int> mm;
int main(){
int r,k,i,c=0,x=0,y=0,j,t,l,z,x1=0,y1=0;
ll ans=0;string p;
mm['B']=mm['F']=mm['P']=mm['V']=1;
mm['C']=mm['G']=mm['J']=mm['K']=mm['Q']=mm['S']=mm['X']=mm['Z']=2;
mm['D']=mm['T']=3;
mm['L']=4;
mm['M']=mm['N']=5;
mm['R']=6;
while(cin>>p){
c=0;
string s;
f(i,0,p.size())
if(mm.find(p[i])!=mm.end())
s+=(mm[p[i]]+'0');
else if(s.size()!=0){
f(j,0,s.size()){
while(s[j]==s[j+1] && j+1<s.size())
j++;
cout<<s[j];
}
s.clear();
}
if(s.size()!=0){
f(j,0,s.size()){
while(s[j]==s[j+1] && j+1<s.size())
j++;
cout<<s[j];
}
s.clear();
}
nl;
}
return 0;
}
No comments:
Post a Comment