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
>

When I input db into my code or any other mirrored pair it returns ordinary pair. Help!

i think thats something for yourself to debug, but you have an syntax error on your end

I figured it out after I got my brother to help me. Thanks!

is pq and bd count as mirrored


can somone tell me why there is a pq after the two-spaced line?

Don't mind it. It's just to specify that the program should break after a line with 2 spaces.

why do i keep getting no such elements exception when i submit it and why do i still earn points? does it change if i get it right or wrong? also, i keep getting 0 on the last test case, so can anyone help? thanks.

is there a extra pair after the two-lined space in the test cases? if so, should i add a extra input for it?

also, i don't get any error with or without the extra pair after the two spaced line. so is it something wrong with the test case or what?

Your program should break as soon as it encounters the two-spaced line.
Your three comments could easily fit into one.

thanks for the information, so can you answer my questions now? not to be rude or anything.
also, it is still like that with out the extra input.
hopefully someone will answer soon because it is 8 pm and i need to hand in the homework tomorrow.

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]