Description
Input
Output
Sample Input
SGC CGGJX GC BMHVQ BGU BCIHNYNBX GNPLV!
Sample Output
THE FLOWS OF MAGIC ARE WHIMSICAL TODAY!
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include<cstdio>
#include<iostream>
#include <map>
using namespace std;
char a[50]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char s[1000010],b;
int i,chan,num=0;
int f[100010],x,j;
int main()
{
f[0]=1;
f[1]=1;
for(int i=2;i<=100000;i++)
f[i] = (f[i-1]%26+f[i-2]%26)%26;
while(gets(s)!=NULL)
{
num = 0;
chan=strlen(s);
for(i=0;i<chan;i++)
{
if(s[i]<'A'||s[i]>'Z')
printf("%c",s[i]);
else
{
for(j=0;j<=25;j++)
if(s[i]==a[j])
{
x=j;
break;
}
x+=f[num];
x=x%26;
printf("%c",a[x]);
num++;
}
}
printf("\n");
}
return 0;
}