SPOJ Problem Set (classical)

3378. Mirrored Pairs

Problem code: MIRRORED

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

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

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.

Example

Input:
Fr
qp
HH
db
  
pq

Output:
Ready
Ordinary pair
Mirrored pair
Ordinary pair
Mirrored pair

All Submissions
Best Solutions


Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Apr 08, 2011

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

<
1
2
>

e45xy6j

I keep getting wrong answers, but I don't know the source of these of these errors. All the test cases do work for me, and when 2 spaces are input, the program does end.I have considered all variations of mirrored pairs, so I don't see where I went wrong, unless uppercases are included. I have been reading the comments, and it seems there was an error in the past.
Could this (or something similar) be it? Or am I just missing some obvious problem?

I honestly have no idea what im doing wrong

Does it work on the samples fine? Try it on ideone. Specifically, you are checking a[0] without ever initializing a, and I'm not sure how well std::string handles that sort of thing

Works fine there

FML i realized what was wrong. I had a capital P for pair.

LOL



[he's NOT my friend]
[stranger]

jialeyu:
LOL




[he's my friend]

Your program should end immediately when it encounters a line with two spaces.


I don't get it. How do I do it in C++?

use
getline(cin, stringname);


then you can just check if
stringname == "  "

Why am I getting 0/300?

Look at the sample output very carefully.

Hi! I'm having trouble trying to find out how to automatically end the program (in python 3) when two spaces occur. Please help me!

Use the break keyword. Ex: "if chars == " ":
break

That will end a while loop.

are things like 'mm','nn',and 'ii' considered mirrored pairs?

We refuse to count self-mirrors as mirrored pairs.

Thanks!! I guess I didn't read the question carefully enough...

LOL




[he's my friend]


How can this simple program take too long to evaluate? Only one of the test cases though. Can someone help me with this?

There's an end condition that you're not considering. Hint: you probably won't be able to test this via console.

Isnt the end condition two spaces in a line?

Sorry about that. Again, I guess I didn't look at your code carefully enough.

This was a problem on our end. I fixed it and rejudged, and you're now getting AC. :-)

Thanks for your fast help! :)

can this be considered a mirror input:
_bd_
or
b_db_d
?

There are only two characters per line.

I tried it many times but still get 0/100. .

You're not checking for every single possibility that causes a mirrored pair.