Canadian Computing Competition: 2016 Stage 1, Senior #1
An anagram of a string is formed by rearranging the letters in the string. For example, the anagrams of aab are aab, aba, and baa.
A wildcard anagram of a string is an anagram of the string where some of the letters might have been replaced with an asterisk (*
). For example, two possible wildcard anagrams of aab are *ab and *b*.
Given two strings, determine whether the second string is a wildcard anagram of the first string.
Input Specification
The two lines of input will both consist of
characters. Each character in the first line will be a lowercase letter. Each character in the second line will be either a lowercase letter or an asterisk.
For 8 of the 15 available marks, the second line will not contain any asterisk characters.
Output Specification
Output the character A
if the string on the second line is a wildcard anagram of the string on the first line. Otherwise, output the character N
.
Sample Input 1
abba
baaa
Output for Sample Input 1
N
Sample Input 2
cccrocks
socc*rk*
Output for Sample Input 2
A
Comments
Warning: do not include a check if there are no wild cards
Could an input be '****'?
Yes it can be
Can i use "*" to replace two different letters? eg: aabcd ----> a**cd
Yes, It can be
I can't get more than 9 points and idk what it could be other than this
This is a reminder that spam is not appreciated. Please read the comment rules and guidelines before posting, lest you be banned.
how is that spam? He's just asking a question.
You should look at the time stamps more carefully before commenting. That was in reference to comments cleaned up over a year ago.