Garamana
An anagram of a word is a rearrangement of the letters of the word. For example,
- "taro" is an anagram of "rato";
- "roma" is an anagram of "amor"; and
- the anagrams of "aab" are "aab", "aba", and "baa".
A wildcard anagram of a word is an anagram where some of the letters may have been replaced by the character '*' (asterisk). For example, three possible wildcard anagrams of "roma" are "*oma", "r*ma", and "ro*a".
Given two words, write a program to determine if the second word is a wildcard anagram of the first word.
Input
The first line of the input contains , the first word. The second line contains , the second word.
Output
Your program should produce a single line, containing a single character, which should be 'S' if is a wildcard anagram of , or 'N' otherwise.
Constraints
- length of
- length of = length of
- is composed of unaccented lowercase letters
- is composed of unaccented lowercase letters and the character '*' (asterisk)
Scoring Information
- For a set of test cases worth 50 points, contains only unaccented lowercase letters.
Input Samples | Output Samples |
---|---|
roma
ator |
N
|
olimpiada
poliamida |
S
|
microfone
*conform* |
S
|