The Jamie Files


Submit solution

Points: 1
Time limit: 1.0s
Python 3 1.5s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python

Life as CFO of AUCPL.inc was going great, until the 'Jamie Files' were leaked.

Your assistant slams a suspiciously heavy stack of allegations onto your desk. Apparently, what happened on Jamie's private island did not stay on Jamie's private island. The media has the story, the shareholders are panicking, and you are in serious trouble.

After poring through the documents, your assistant pulls out a black marker.

"It looks bad", they whisper, "but if we can redact at least k copies of your name from the files, those bloodthirsty reporters might lose interest..."

You may redact the files by selecting one, contiguous substring and replacing all its characters with #. To avoid suspicion, you want to redact as few characters as possible, so that your name appears at least k fewer times in the Jamie Files.

An instance of your name is any substring equal in the Jamie Files to your name. Instances may overlap.

What is the minimum length substring you must redact?

Input

The first line of the input contains three integers, n, m and k, the length of the Jamie Files, the length of your name, and the number of instances of your name you need to remove (1 \leq n, m, k \leq 10^5).

The next line of the input contains a string of length n, the complete Jamie Files. These files contain only lowercase English characters.

The next line of the input contains a string of length m, your name. Your name contains only lowercase English characters.

Output

Output the minimum number of characters you need to redact from the Jamie Files, so that your name appears at least k fewer times in the Jamie Files. If this is not possible, output impossible.

Notes

  • The redacted letters are not deleted (you can think of replacing them with #), so additional instances of your name will not be created by redaction.
  • There may be fewer than k instances of your name in the Jamie Files to begin with. In that case, it's not possible to redact k instances of your name.

Example

Input 1
53 3 2
jamieleakedraysactivitiesraywasthereraydidthosethings
ray
Output 1
10

You need to redact at least 10 characters from the Jamie files to remove 2 instances of ray.

Image 1

Input 2
22 4 2
kikikilledkikiisguilty
kiki
Output 2
1

Instances of names can overlap. Just 1 character needs to be redacted to remove 2 instances of kiki.

Image 2

Input 3
18 7 3
kevinpatricktomray
patrick
Output 3
impossible

There's only 1 instance of patrick in the Jamie Files, it is impossible to remove 3 instances of his name.


Comments

There are no comments at the moment.