Special Judge

Time limit1sMemory limit128 MB

Summary
Decide whether the given string appears as a contiguous block in both A and B.
Level

Medium4 of 10

Topics
String matching, String
Solved
No attempts yet

Problem

Write the judging program for the longest common substring problem.

The original problem is this. Given two strings AA and BB, print the longest string that occurs as a contiguous block in both of them. Several strings can tie for the longest and any of them counts as correct, so comparing the output against one fixed answer cannot judge it.

The judging program decides whether the string the user printed is a correct answer. For convenience, assume that the length of the printed string equals the answer to the problem, and that the answer is greater than 0.

Input

The first line and the second line contain the strings AA and BB, one per line. The sum of the two lengths is at most 200,000.

The third line contains the string the user printed. Every string in the input consists of lowercase letters only, and its length is at most 200,000.

Output

Print YES if the string the user printed is a correct answer, and NO otherwise.

Examples2

  1. Example 1

    Input
    yeshowmuchiloveyoumydearmotherreallyicannotbelieveit
    yeaphowmuchiloveyoumydearmother
    howmuchiloveyoumydearmother
    
    Expected output
    YES
    
  2. Example 2

    Input
    abcdefg
    zzabcdyy
    abcz
    
    Expected output
    NO