View Code of Problem 108

#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    int n,a[999];
    cin>>n;
    string s;
    while(n--){
        cin>>s;
        a[1]=1,a[2]=2;
        for(int i=3;i<=s.length();i++){
            a[i]=a[i-1]+a[i-2];
        }
        cout<<a[s.length()]<<endl;
    }
    return 0;
}


Double click to view unformatted code.


Back to problem 108