CCC '07 J4 - Anagram Checker

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 256M

Problem type
Canadian Computing Competition: 2007 Stage 1, Junior #4

An anagram is a word or a phrase formed by rearranging the letters of another phrase such as ITEM and TIME. Anagrams may be several words long such as CS AT WATERLOO and COOL AS WET ART. Note that two phrases may be anagrams of each other even if each phrase has a different number of words (as in the previous example). Write a program to determine if two phrases are anagrams of each other.

Input Specification

The program should take two phrases, each on a separate line. You may assume that the input only contains uppercase letters and spaces.

Output Specification

The program will print out one of two statements: Is an anagram. or Is not an anagram.

Sample Input

CS AT WATERLOO
COOL AS WET ART

Sample Output

Is an anagram.

Comments


  • 2
    jfan27  commented on Oct. 24, 2024, 12:20 p.m.

    Fun fact: you can do this in one line in python. Give it a try.


  • -4
    jedidiah  commented on Aug. 22, 2024, 10:36 a.m.

  • 1
    rfasta  commented on June 14, 2024, 8:39 p.m. edited

    if ur getting it wrong try aabbcc and aabccc


  • -9
    yeshengdazuo  commented on Feb. 15, 2024, 2:11 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


    • 1
      teddycitrus  commented on Feb. 19, 2024, 12:26 p.m.

      no offense but how does one come to such a conclusion? the task here is just to check if the characters used/amount of each in both phrases are the same


  • 0
    Eddy_L  commented on Jan. 10, 2023, 11:34 p.m.

    Why do I get test 6 wrong(WA)?


    • 5
      Kirito  commented on Jan. 11, 2023, 1:11 a.m.

      Check what .replace does. (Hint: the original string remains unmodified.)


      • 11
        passf  commented on Nov. 23, 2023, 6:42 p.m.

        u weeb


        • 1
          LTak3r_fan  commented on Dec. 8, 2023, 8:06 p.m.

          based reply