View Code of Problem 108

import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        for (int i = 0; i < T; i++) {
            String input = scanner.next();
            int len = input.length();
            long res = 0, a = 0, b = 1;
            for (int j = 0; j < len; j++) {
                res = a + b;
                a = b;
                b = res;
            }
            System.out.println(res);
        }
    }
}

Double click to view unformatted code.


Back to problem 108