#D8252. AABABCAC

    ID: 6856 Type: Default 1000ms 536MiB

AABABCAC

AABABCAC

Problem

Given the strings s s , t t . First, let the string set A= A = {s s }, B= phi B = \ phi . At this time, I want to perform the following operations as much as possible.

operation

step1

Perform the following processing for all uA u ∊ A .

  1. From all subsequences of u u (not necessarily contiguous), choose any one that is equal to t t . Let the indexes corresponding to u u of the selected subsequence be z1 z_1 , z2 z_2 ,…, zt z_ {| t |} (however, 1  le \ le z1 z_1  lt \ lt z2). z_2).  lt \ lt  lt \ lt zt z_ {| t |}  le \ le u | u | ). If there is no such subsequence, the operation ends.

  2. Divide the original string with the selected substring characters uz1 u_ {z_1} , uz2 u_ {z_2} ,…, uzt u_ {z_ {| t |}} and convert them to B B to add.

For example, in the case of u= u = "abcdcd" and t= t = "ac", the following two division methods can be considered. If you choose the first and third characters of u u , it will be split into "", "b" and "dcd". If you choose the first and fifth characters of u u , it will be split into "", "bcd" and "d".

step2

Replace A A with B B and empty B B . Increase the number of operations by 1.

Subsequence example

The subsequences of "abac" are {"", "a", "b", "c", "aa", "ab", "ac", "ba", "bc", "aac", "aba" "," abc "," bac "," abac "}. "a" is a subsequence created by extracting the first or third character of "abac". "ac" is a subsequence created by extracting the 1st and 4th characters of "abac" or the 3rd and 4th characters.

Constraints

The input satisfies the following conditions.

  • 1  le \ le t | t |  le \ le s | s |  le \ le 105 10 ^ 5
  • Characters contained in the strings s s and t t are uppercase or lowercase letters of the alphabet

Input

The input is given in the following format.

s s t t

The string s s is given on the first line, and the string t t is given on the second line.

Output

Output the maximum number of operations.

Examples

Input

AABABCAC A

Output

2

Input

abaabbabaabaabbabbabaabbab ab

Output

3

Input

AbCdEfG aBcDeFg

Output

0

inputFormat

input satisfies the following conditions.

  • 1  le \ le t | t |  le \ le s | s |  le \ le 105 10 ^ 5
  • Characters contained in the strings s s and t t are uppercase or lowercase letters of the alphabet

Input

The input is given in the following format.

s s t t

The string s s is given on the first line, and the string t t is given on the second line.

outputFormat

Output

Output the maximum number of operations.

Examples

Input

AABABCAC A

Output

2

Input

abaabbabaabaabbabbabaabbab ab

Output

3

Input

AbCdEfG aBcDeFg

Output

0

样例

abaabbabaabaabbabbabaabbab
ab
3