Advertisement
N3r0_H4x0r_EvilSec

Password Pat

Nov 4th, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. Password Pat
  2. -------- ---
  3.  
  4. Password Pat is known for making slick passwords such
  5. as
  6. @hwl2rt&tk
  7.  
  8. which is derived from the sentence
  9.  
  10. At Hogwarts we love to roast tyrants and tea kettles.
  11.  
  12. by applying the following rules while reading the
  13. sentence:
  14.  
  15. (1) On reading a non-special word, output its first
  16. letter in lower case.
  17.  
  18. Here and in (2) a word is any sequence of upper or
  19. lower case letters surrounded by non-letters.
  20.  
  21. (2) The special words and the single character to
  22. output are:
  23.  
  24. and & zero 0
  25. or | one 1
  26. not ! two 2
  27. equal = three 3
  28. plus + four 4
  29. minus - five 5
  30. times * six 6
  31. slash / seven 7
  32. dollar $ eight 8
  33. percent % nine 9
  34. at @ to 2
  35. for 4
  36. ate 8
  37.  
  38. Note these words are recognized even if some of
  39. their letters are capitals.
  40. (3) On reading space characters, output nothing.
  41.  
  42. (4) On reading punctuation, output the punctuation,
  43. except on reading a period output nothing. Punctua-
  44. tion is any character that is not a letter or space
  45. character.
  46.  
  47. (5) Numbers are not permitted in the sentence (unless
  48. spelled out as words). Quotes and apostrophes are
  49. not permitted.
  50.  
  51. Pat does not limit herself to a single input sentence.
  52. For example, the input
  53.  
  54. fairly! squarely! I won?
  55.  
  56. produces the password: f!s!iw?
  57.  
  58. You are to write a program that will apply Pat's rules
  59. to sentences to derive a password.
  60.  
  61. Input
  62. -----
  63.  
  64. Lines each of which contains one or more sentences.
  65. Words on the line are sequences of consecutive letters.
  66. All input characters are letters, spaces, or one of the
  67. punctuation characters .!?, . No line is longer than
  68. 80 characters. Input ends with an end of file.
  69.  
  70.  
  71. Output
  72. ------
  73.  
  74. One line containing a password for each input line. The
  75. password on a line must be that derived by applying
  76. Pat's rules to the sentences in the corresponding input
  77. line. There are no spaces or tabs in any output line.
  78.  
  79. Sample Input
  80. ------ -----
  81.  
  82. At Hogwarts we love to roast tyrants and tea kettles.
  83. fairly! squarely! I won?
  84. Slash and burn politics is for the minus birds.
  85. I want to replace foobar with fee, fie, foe, fum!
  86. I count zero, one, two, and you think ten, nine, eight.
  87.  
  88.  
  89. Sample Output
  90. ------ ------
  91.  
  92. @hwl2rt&tk
  93. f!s!iw?
  94. /&bpi4t-b
  95. iw2rfwf,f,f,f!
  96. ic0,1,2,&ytt,9,8
  97.  
  98.  
  99.  
  100.  
  101. File: passwords.txt
  102. Author: Bob Walton <walton@deas.harvard.edu>
  103. Date: Mon Aug 8 10:48:48 EDT 2005
  104.  
  105. The authors have placed this file in the public domain;
  106. they make no warranty and accept no liability for this
  107. file.
  108.  
  109. RCS Info (may not be true date or author):
  110.  
  111. $Author: hc3 $
  112. $Date: 2005/08/08 14:50:30 $
  113. $RCSfile: passwords.txt,v $
  114. $Revision: 1.10 $
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement