Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Password Pat
- -------- ---
- Password Pat is known for making slick passwords such
- as
- @hwl2rt&tk
- which is derived from the sentence
- At Hogwarts we love to roast tyrants and tea kettles.
- by applying the following rules while reading the
- sentence:
- (1) On reading a non-special word, output its first
- letter in lower case.
- Here and in (2) a word is any sequence of upper or
- lower case letters surrounded by non-letters.
- (2) The special words and the single character to
- output are:
- and & zero 0
- or | one 1
- not ! two 2
- equal = three 3
- plus + four 4
- minus - five 5
- times * six 6
- slash / seven 7
- dollar $ eight 8
- percent % nine 9
- at @ to 2
- for 4
- ate 8
- Note these words are recognized even if some of
- their letters are capitals.
- (3) On reading space characters, output nothing.
- (4) On reading punctuation, output the punctuation,
- except on reading a period output nothing. Punctua-
- tion is any character that is not a letter or space
- character.
- (5) Numbers are not permitted in the sentence (unless
- spelled out as words). Quotes and apostrophes are
- not permitted.
- Pat does not limit herself to a single input sentence.
- For example, the input
- fairly! squarely! I won?
- produces the password: f!s!iw?
- You are to write a program that will apply Pat's rules
- to sentences to derive a password.
- Input
- -----
- Lines each of which contains one or more sentences.
- Words on the line are sequences of consecutive letters.
- All input characters are letters, spaces, or one of the
- punctuation characters .!?, . No line is longer than
- 80 characters. Input ends with an end of file.
- Output
- ------
- One line containing a password for each input line. The
- password on a line must be that derived by applying
- Pat's rules to the sentences in the corresponding input
- line. There are no spaces or tabs in any output line.
- Sample Input
- ------ -----
- At Hogwarts we love to roast tyrants and tea kettles.
- fairly! squarely! I won?
- Slash and burn politics is for the minus birds.
- I want to replace foobar with fee, fie, foe, fum!
- I count zero, one, two, and you think ten, nine, eight.
- Sample Output
- ------ ------
- @hwl2rt&tk
- f!s!iw?
- /&bpi4t-b
- iw2rfwf,f,f,f!
- ic0,1,2,&ytt,9,8
- File: passwords.txt
- Author: Bob Walton <walton@deas.harvard.edu>
- Date: Mon Aug 8 10:48:48 EDT 2005
- The authors have placed this file in the public domain;
- they make no warranty and accept no liability for this
- file.
- RCS Info (may not be true date or author):
- $Author: hc3 $
- $Date: 2005/08/08 14:50:30 $
- $RCSfile: passwords.txt,v $
- $Revision: 1.10 $
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement