#C6816. Anagram Prefix Detection

    ID: 50618 Type: Default 1000ms 256MiB

Anagram Prefix Detection

Anagram Prefix Detection

Given two strings, P (called the prefix) and T (the text), determine whether any anagram of P is a prefix of T. In other words, if we denote m = |P| and n = |T| and consider the substring T[0:m] (i.e. the first m characters of T), check if this substring is a permutation (anagram) of P.

This can be mathematically expressed as checking if:

\( \text{Freq}(P) = \text{Freq}(T[0:m]) \)

where \( \text{Freq}(X) \) denotes the frequency count of characters in string \( X \).

inputFormat

The input consists of two lines:

  1. The first line contains the string P (prefix).
  2. The second line contains the string T (text).

You can assume that the strings only contain standard printable characters without spaces.

outputFormat

Output a single line containing either True or False (case-sensitive), indicating whether an anagram of P is a prefix of T.

## sample
abc
cbaebabacd
True

</p>