Yes, you are developing a ‘Love calculator’. The software would be quite complex such that nobody could crack the exact behavior of the software.
So, given two names your software will generate the percentage of their ‘love’ according to their names. The software requires the following things:
The length of the shortest string that contains the names as subsequence.
Total number of unique shortest strings which contain the names as subsequence.
Now your task is to find these parts.
Input
Input starts with an integer T (≤ 125), denoting the number of test cases.
Each of the test cases consists of two lines each containing a name. The names will contain no more than 30 capital letters.
Output
For each of the test cases, you need to print one line of output. The output for each test case starts with the test case number, followed by the shortest length of the string and the number of unique strings that satisfies the given conditions.
You can assume that the number of unique strings will always be less than 263. Look at the sample output for the exact format.
Sample Input
Output for Sample Input
3
USA
USSR
LAILI
MAJNU
SHAHJAHAN
MOMTAJ
Case 1: 5 3
Case 2: 9 40
Case 3: 13 15
轉移很簡單
但是有一個地方要注意:
如果
/*************************************************************************
> File Name: LightOJ1013.cpp
> Author: ALex
> Mail: [email protected]
> Created Time: 2015年06月07日 星期日 21時41分25秒
************************************************************************/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include