ZOJ 1392 The Hardest Problem Ever

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <map>
using namespace std;

char Cipher[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char Plain[] ="VWXYZABCDEFGHIJKLMNOPQRSTU";

int main()
{
    char str[110];
    while(gets(str))
    {
        if(strcmp(str,"ENDOFINPUT")==0)
            break;
        if(strcmp(str,"START")==0)
        {
            while(true)
            {
                gets(str);
                if(strcmp(str,"END")==0)
                    break;
                int len=strlen(str);
                for(int i=0;i<len;i++)
                {
                    if('A'<=str[i]&&str[i]<='Z')
                    {
                        str[i]=Plain[str[i]-'A'];
                    }
                }
                printf("%s\n",str);
            }
        }
    }

    return 0 ;
}

你可能感兴趣的:(ZOJ 1392 The Hardest Problem Ever)