Boring Lesson

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Ildar is attending a boring online lesson. In order to do something, he transforms strings. Initially, he has a string ss. Ildar wants to get a string tt from the string ss in minimum number of steps. In one step he can:

  • Remove a character from any position.
  • Insert any character to any position. I.e. before the first character, between two adjacent characters, or after the last character.
  • Replace character at any position with any other character.

The minimum number of such steps needed to transform string ss into string tt is also known as edit distance between ss and tt.

Ildar has nn favorite strings w_iw\_i. Consider sequence of strings that would occur during the transformation: s=x_1s = x\_1, x_2x\_2, \dots, x_m1x\_{m - 1}, x_m=tx\_m = t. Ildar wants as many of w_iw\_i as possible to appear in the set x_1,x_2,,x_m\\{x\_1, x\_2, \dots, x\_m\\}. Help Ildar to find out what is the minimum number of steps needed to transform ss to tt, and what is the maximum number of w_iw\_i that can appear during this process, also print these strings.

입력

The first line of input contains the string ss.

The second line of input contains the string tt.

The third line contains a single integer nn (0n1,0000 \le n \le 1\\,000). The following nn lines contain strings w_iw\_i.

All strings consist of lowercase English letters, are non-empty, their lengths don't exceed 10,00010\\,000. The total length of all strings doesn't exceed 10,00010\\,000. All strings are distinct, including sts \neq t, sw_is \neq w\_i and tw_it \neq w\_i.

출력

Output two integers at the first line of output --- the minimum number of steps, needed to transform ss into tt, and the maximum number of strings w_iw\_i that can appear in the process of transformation.

After that, output strings w_iw\_i that can appear during the transformation, in the same order they would appear. If there are multiple correct answers, you can output any of them.

힌트

In the second example one of correct transformations is the following:

"longlong" \rightarrow "longleng" \rightarrow "dongleng" \rightarrow "dongleg" \rightarrow "dongle" \rightarrow "donble" \rightarrow "double"

Ildar's favorite strings are highlighted.