#include <iostream>
#include <string>
using namespace std;

char getNumber(char c){
    if(c=='B'||c=='F'||c=='P'||c=='V')return '1';
    if(c=='C'||c=='G'||c=='J'||c=='K'||c=='Q'||c=='S'||c=='X'||c=='Z')return '2';
    if(c=='D'||c=='T')return '3';
    if(c=='L')return '4';
    if(c=='M'||c=='N')return '5';
    if(c=='R')return '6';
    return '0';
}
int main(){
    string a,n="",n1="",n2="";
    cin>>a;
    for(int i=1;i<a.size();i++){
    char c = a[i];
    if(c=='A'||c=='E'||c=='I'||c=='O'||c=='U'||c=='H'||c=='W'||c=='Y')continue;
        n+=getNumber(c);}
    char p=' ';
        for(int i=0;i<n.size(); i++) {
        if(n[i] != p) {
            n1+=n[i];
            p=n[i];}
    }
    n2+=a[0];n2+=n1;
    if(n2.size()>4){
        n2=n2.substr(0,4);
    }
    while(n2.size()<4)n2+='0';
    cout<<n2;
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: