救救蒟蒻

P1603 斯诺登的密码

jiangyunuo @ 2024-12-14 14:54:16

#include<bits/stdc++.h>  
using namespace std;
int main(){
    char ch[100];
    string a[10];
    int tot=0,len;
    for(int i=1;i<=6;i++){
        cin>>ch;
        len=strlen(ch);
        for(int j=1;j<=len;j++)if(ch[i]<=90)ch[i]+=32;
        if(ch[0]=='z'&&ch[1]=='e'&&ch[2]=='r'&&ch[3]=='o'){a[++tot][0]='0';}
        if(ch[0]=='a'||ch[0]=='a'&&ch[1]=='n'&&ch[2]=='o'&&ch[3]=='t'&&ch[4]=='h'&&ch[5]=='e'&&ch[6]=='r'||ch[0]=='f'&&ch[1]=='i'&&ch[2]=='r'&&ch[3]=='s'&&ch[4]=='t'){a[++tot][0]='1';}
        if(ch[0]=='t'&&ch[1]=='w'&&ch[2]=='o'||ch[0]=='s'&&ch[1]=='e'&&ch[2]=='c'&&ch[3]=='o'&&ch[4]=='n'&&ch[5]=='d'||ch[0]=='b'&&ch[1]=='o'&&ch[2]=='t'&&ch[3]=='h'){a[++tot][0]='4';}
        if(ch[0]=='t'&&ch[1]=='h'&&ch[2]=='r'&&ch[3]=='e'&&ch[4]=='e'||ch[0]=='t'&&ch[1]=='h'&&ch[2]=='i'&&ch[3]=='r'&&ch[4]=='d'){a[++tot][0]='9';}
        if(ch[0]=='f'&&ch[1]=='o'&&ch[2]=='u'&&ch[3]=='r'){a[++tot][0]='1';a[++tot][1]='6';}
        if(ch[0]=='f'&&ch[1]=='i'&&ch[2]=='v'&&ch[3]=='e'){a[++tot][0]='2';a[++tot][1]='5';}
        if(ch[0]=='s'&&ch[1]=='i'&&ch[2]=='x'){a[++tot][0]='3';a[++tot][1]='6';}
        if(ch[0]=='s'&&ch[1]=='e'&&ch[2]=='v'&&ch[3]=='e'&&ch[4]=='n'){a[++tot][0]='4';a[++tot][1]='9';}
        if(ch[0]=='e'&&ch[1]=='i'&&ch[2]=='g'&&ch[3]=='h'&&ch[4]=='t'){a[++tot][0]='6';a[++tot][1]='4';}
        if(ch[0]=='n'&&ch[1]=='i'&&ch[2]=='n'&&ch[3]=='e'){a[++tot][0]='8';a[++tot][1]='1';}
        if(ch[0]=='t'&&ch[1]=='e'&&ch[2]=='n'){a[++tot][0]='0';}
        if(ch[0]=='e'&&ch[1]=='l'&&ch[2]=='e'&&ch[3]=='v'&&ch[4]=='e'&&ch[5]=='n'){a[++tot][0]='2';a[++tot][1]='1';}
        if(ch[0]=='t'&&ch[1]=='w'&&ch[2]=='e'&&ch[3]=='l'&&ch[4]=='v'&&ch[5]=='e'){a[++tot][0]='4';a[++tot][1]='4';}
        if(ch[0]=='t'&&ch[1]=='h'&&ch[2]=='i'&&ch[3]=='r'&&ch[4]=='t'&&ch[5]=='e'&&ch[6]=='e'&&ch[7]=='n'){a[++tot][0]='6';a[++tot][1]='9';}
        if(ch[0]=='f'&&ch[1]=='o'&&ch[2]=='u'&&ch[3]=='r'&&ch[4]=='t'&&ch[5]=='e'&&ch[6]=='e'&&ch[7]=='n'){a[++tot][0]='9';a[++tot][1]='6';}
        if(ch[0]=='f'&&ch[1]=='i'&&ch[2]=='f'&&ch[3]=='t'&&ch[4]=='e'&&ch[5]=='e'&&ch[6]=='n'){a[++tot][0]='2';a[++tot][1]='5';}
        if(ch[0]=='s'&&ch[1]=='i'&&ch[2]=='x'&&ch[3]=='t'&&ch[4]=='e'&&ch[5]=='e'&&ch[6]=='n'){a[++tot][0]='5';a[++tot][1]='6';}
        if(ch[0]=='s'&&ch[1]=='e'&&ch[2]=='v'&&ch[3]=='e'&&ch[4]=='n'&&ch[5]=='t'&&ch[6]=='e'&&ch[7]=='e'&&ch[8]=='n'){a[++tot][0]='8';a[++tot][1]='9';}
        if(ch[0]=='e'&&ch[1]=='i'&&ch[2]=='g'&&ch[3]=='h'&&ch[4]=='t'&&ch[5]=='e'&&ch[6]=='e'&&ch[7]=='n'){a[++tot][0]='2';a[++tot][1]='4';}
        if(ch[0]=='n'&&ch[1]=='i'&&ch[2]=='n'&&ch[3]=='e'&&ch[4]=='t'&&ch[5]=='e'&&ch[6]=='e'&&ch[7]=='n'){a[++tot][0]='6';a[++tot][1]='1';}
        if(ch[0]=='t'&&ch[1]=='w'&&ch[2]=='e'&&ch[3]=='n'&&ch[4]=='t'&&ch[5]=='y'){a[++tot][0]='0';}
    }
    sort(a+1,a+tot+1);
    bool z=0;
    int c;
    for(int i=1;i<=tot;i++){
        c=a[i].size();
        for(int j=0;j<c;j++){
            if(a[i][j]=='0'&&z)cout<<0;
            if(a[i][j]>'0'&&a[i][j]<='9'){cout<<a[i][j];z=1;}
        }
    }
    cout<<endl;
    return 0;
}

|