Mirrored Pairs

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 16M

Problem type

The letters b and d are mirror images of each other, as are p and q. No other pairs of letters are mirrors, except for letters like H that are mirrors of themselves, and what's the interest in a pair that's just two of the same letter? We refuse to count self-mirrors as mirrored pairs.

Input Specification

Input is a list of lines with two characters on each line. Your program should end immediately when it encounters a line with two spaces.

Output Specification

The first line of output should contain only Ready. For each pair of characters (prior to a pair of spaces), print the line Mirrored pair if the characters are mirrors, otherwise print the line Ordinary pair.

Sample Input


Sample Output

Ordinary pair
Mirrored pair
Ordinary pair
Mirrored pair


  • 0
    AccidentalGenius  commented on March 11, 2024, 7:01 a.m.

    I keep getting an IR (invalid return) on all the test cases and when I check the output DMOJ got it has "Or" at the end of it even there is nothing in my code that should print that (btw im using python 3). When I test my code in my own IDE it runs perfectly. I have no idea what I'm doing wrong.

  • 3
    SagarSaha  commented on Nov. 21, 2020, 4:45 a.m.

    In the input specification, it says that the program should end immediately when it encounters a line with 2 spaces. But in the sample input, there is a line after 2 spaces. On line 5 there are 2 spaces and on line 6 there are 2 letters. How is the program taking in the input after a line that contains 2 spaces? Shouldn't the program end at line 5?

    • 7
      Badmode  commented on Nov. 22, 2020, 12:39 a.m.

      The output specification says the first line of output will always be "Ready" - the program will then start to execute the inputs after "Ready".

      N/A - Ready

      Fr - Ordinary pair

      qp - Mirrored pair

      HH - Ordinary pair

      db - Mirrored pair

      [Two spaces] - [Program Stop]

      pq - [Stopped]