Under construction

Still being built. Things may change

Wildcard Anagram

Interview

Time limit2sMemory limit512 MB

Summary
Given two equal-length strings, check whether the second is an anagram of the first after treating its asterisks as any letters.
Level

Easy3 of 10

Topics
String, Hash map, Sorting, Implementation
Solved
No attempts yet

Problem

An anagram of a string is formed by rearranging the letters of the string. For example, the anagrams of aab are aab, aba, and baa.

A wildcard anagram of a string is an anagram of that string in which some letters have been replaced with an asterisk *. For example, *ab and *b* are wildcard anagrams of aab. Replacing no letter at all is allowed, so every anagram is also a wildcard anagram.

Given two strings, decide whether the second string is a wildcard anagram of the first string.

Input

The first line and the second line each contain one string, and both strings have the same length NN (1≤N≤1001 \le N \le 100). Every character on the first line is a lowercase letter. Every character on the second line is a lowercase letter or an asterisk *.

Output

Print A on one line if the string on the second line is a wildcard anagram of the string on the first line, and N otherwise.

Examples5

  1. Example 1

    Input
    abba
    baaa
    
    Expected output
    N
    
  2. Example 2

    Input
    cccrocks
    socc*rk*
    
    Expected output
    A
    
  3. Example 3

    Input
    a
    *
    
    Expected output
    A
    
  4. Example 4

    Input
    a
    b
    
    Expected output
    N
    
  5. Example 5

    Input
    aab
    *b*
    
    Expected output
    A