CCC '16 S1 - Ragaman

View as PDF

Submit solution


Points: 4 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type

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 N (1 \le N \le 100) 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


  • 0
    bonnehomme  commented on Jan. 8, 2019, 4:04 p.m.

    Could an input be '****'?


  • 1
    IanHu  commented on Dec. 29, 2018, 3:07 p.m.

    Can i use "*" to replace two different letters? eg: aabcd ----> a**cd


  • 0
    Kirito  commented on Aug. 24, 2017, 10:53 p.m.

    This is a reminder that spam is not appreciated. Please read the comment rules and guidelines before posting, lest you be banned.


    • -2
      DA_BIG_MO  commented on Dec. 30, 2018, 10:41 p.m.

      how is that spam? He's just asking a question.


      • 5
        Kirito  commented on Jan. 8, 2019, 7:43 p.m.

        You should look at the time stamps more carefully before commenting. That was in reference to comments cleaned up over a year ago.


        • -5
          JustinXu  commented on Jan. 9, 2019, 2:55 p.m. edit 3

          This comment is hidden due to too much negative feedback. Click here to view it.


          • 3
            ss__jonathan  commented on Jan. 9, 2019, 5:11 p.m. edited

            Regarding this kind of topic, it is better for this to be redirected to the DMOJ Slack. We highly advise you to join it using this link to prevent a chain of Re:'s in the comments.


      • 1
        IanHu  commented on Dec. 31, 2018, 7:08 p.m.

        NOT ME!!!! please look at the comment date :-) (Btw: thanks dude)