View Code of Problem 108

#include<stdio.h>
#include<string.h>
int main(){
	int n;
	scanf("%d",&n);
	int a[50];
	a[1]=1;
	a[2]=2;
	for(int i=3;i<=50;i++){
		a[i]=a[i-1]+a[i-2];
	}
	while(n--){
		char str[50];
		scanf("%s",str);
		int len=strlen(str);
		printf("%d\n",a[len]);
		
			}
	
	
	return 0;
} 

Double click to view unformatted code.


Back to problem 108