Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. public class Solution {
  2. public static void main(String[] args) {
  3. // 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.
  4. // Fr
  5. // qp
  6. // HH
  7. // db
  8.  
  9. // pq
  10. //https://wcipeg.com/problem/a2
  11. Scanner sc= new Scanner(System.in);
  12. System.out.println("Ready");
  13. while (true) {
  14. String S = sc.nextLine(); //including space
  15. if (S.equals(" ") ) {
  16. break;
  17. } else if (S.equals("bd")||S.equals("db")||S.equals("pq") ||S.equals("qp")) {
  18. System.out.println("Mirrored pair");
  19. } else {
  20. System.out.println("Ordinary pair");
  21. }
  22. }
  23.  
  24.  
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement