Advertisement
Guest User

Decipher

a guest
Jul 20th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1.  
  2. /**
  3. * You work for a spy agency, and have been tasked with writing a program that can decipher encoded words.
  4. *
  5. * Words are encoded using a 1:1 character mapping.
  6. * For example, if the character mapping being used is a->3, b->Z, c->#, d->7,
  7. * Then the word 'dad' would be represented as '737'
  8. *
  9. * Your DecipherApp does not know what the character mapping is.
  10. * Instead, it just has a fixed list of all of the possible decoded words.
  11. * e.g. KnownWords = {"book", "took", "tar", "dad", "bib", "deed", "peep"}
  12. *
  13. * DecipherApp is a command line program.
  14. * It continues to ask the user to enter an encoded word to decipher, until the user enters "quit".
  15. * Given an encoded word, the program will output all possible decoded words, based on the character pattern.
  16.  
  17. * For example, if "7##7" is the input, then "deed" and "peep" would be the output.
  18. * Please enter a word to decode
  19. * 7##7
  20. * Possible words are:
  21. * deed
  22. * peep
  23. *
  24. * Please enter a word to decode
  25. * xyz
  26. * Possible words are:
  27. * tar
  28. *
  29. * Please enter a word to decode
  30. * 888
  31. * Unable to find any words that match this pattern.
  32. *
  33. * Please enter a word to decode
  34. * quit
  35. * Goodbye.
  36. */
  37. public class DecipherApp {
  38.  
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement