View Code of Problem 108

#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
	cin>>n;
	while(n--){
		char s[50];
		cin>>s; 
		int len =strlen(s);
		long long a[51] = {0,1,2};
		for(int i = 3; i <= len; i++){
			a[i] = a[i-1] + a[i-2];
		}
		cout<<a[len]<<endl;
	}
}

Double click to view unformatted code.


Back to problem 108