Hidden Password

Decide if scanning the message and skipping letters outside the remaining password set reproduces the password in order.

Easy2SimulationStringInterviewNo attempts yetTime limit1sMemory limit256 MB

Problem

A company hides a password inside a longer string of uppercase letters. That string is called a message, and a message is valid only when it stands in the following relation to the password.

Write the password as c1c2cPc_1 c_2 \dots c_P. The characters need not be distinct. Scan the message from the beginning and look for the first character that belongs to the set {c1,,cP}\{c_1, \dots, c_P\}; that character must be c1c_1. Continue from the position just after it and look for the first character that belongs to {c2,,cP}\{c_2, \dots, c_P\}; that character must be c2c_2. The rule continues the same way through c3c_3 and on to cPc_P.

For example, take the password ABC. The message HAPPYBIRTHDAYCACEY is valid.

  • A is the first character from {A,B,C}\{A, B, C\} to appear. The leading H is not in the set, so it is skipped.
  • Looking after that A, the first character from {B,C}\{B, C\} is B.
  • Looking after that B, the first character from {C}\{C\} is C. The A in DAY does not matter because only a C is being searched for at that point, and the remaining A and C in CACEY do not matter because the password is already complete.

For the same password ABC, the message TRAGICBIRTHDAYCACEY is not valid. A is indeed the first character from {A,B,C}\{A, B, C\} to appear, but after it the first character from {B,C}\{B, C\} is C rather than B.

The message HAPPYBIRTHDAY is also not valid for ABC, because no C ever appears.

Repeated letters in the password follow the same rule. For the password SECRET, the message SOMECHORESARETOUGH is valid. The message SOMECHEERSARETOUGH is not valid, because an extra E turns up at the point where an R is expected.

Input

One line holds two strings separated by a space. The first is the password, of length PP with 3P83 \le P \le 8. The second is the message, of length SS with 10S4010 \le S \le 40. Both strings consist only of uppercase letters, so neither contains whitespace, lowercase letters, digits, or other special characters.

Output

Print a single line. Print PASS if the second string is a valid message for the password, and FAIL otherwise.