The problem is Fibonacci string
My solution:
#include
#include"string"
using namespace std;
int main()
{char s[100001];int t,i=0;
std::cin>>t;
fibo:while(i<t)
{i++;
int k[26]={0};int m=0;
std::cin>>s;
for(int j=0;s[j]!=’\0’;j++)
k[s[j]-97]++;
for(int j=0;j<26;j++)
{int key=k[j];
if(key!=0)
m++;
int l=j-1;
while((l>=0) &&( k[l]<key ))
{k[l+1]=k[l];
l-=1;
}
k[l+1]=key;
}
if(m<3)
{std::cout<<"\nDynamic\n";goto fibo;
}
else
{for(int j=0;j<m-2;j++)
if(k[j]!=k[j+1]+k[j+2])
{cout<<"\nNot\n";goto fibo;
}
std::cout<<"\nDynamic\n";
}
}
return 0;
}
It’s running with no problem in dev c++. But codeshef judge is giving the result as wrong answer. Please help.