View Code of Problem 108

#include<iostream>
#include<string.h>
using namespace std;
int fbnq(int n)
{
  long int a[50];
  a[1]=1;a[2]=2;
  for(int i=3;i<=n;i++)
    a[i]=a[i-1]+a[i-2];
  return a[n];
}
int main()
{
	int n;
	cin>>n;
	while(n)
	{   char str[50];
		cin>>str;
		int len=strlen(str);
		
		cout<<fbnq(len)<<endl;
		n--;
	}
 } 
 

Double click to view unformatted code.


Back to problem 108