
2005
ASIA PROGRAMMING CONTEST – MANILA
October
29, 2005
Problem C
Input File: c.in
Web-based transactions need users to
login with a user-name and password pair. The proper choice of password is
critical for one's personal data security. However, with more websites
requiring users to create a user-name and password pair, users often reuse
passwords from another site or worse, use a dictionary-based password so it
will be easy to remember.
Abigail Christine Mann, or ACM for short,
devised a portable password purse. The purse, however, is virtual - passwords
are not written on a piece of paper or a notebook nor are passwords saved and
protected by software. The purse is made up of algorithms that ACM associates
with each website that she registers with.
ACM devised three basic algorithms to
determine a particular web site's password. She drops the top-level domains
(TLD) such as .edu, .com, .edu.ph, .com.sg, etc., and then follows the
algorithms below.
1.
If the domain name has less than 6 characters, append capitalized initials in
between each character and replace all vowels (except the one from initials) to
its numeric equivalent in the alphabet.
Example:
apple.com
= aApCpMle
= 1ApCpMl5 (password)
2. If the domain
has an even number of letters, split the domain into two, add '%' at the
middle, transpose the first set of letters using the rules below and the second
set of letters are converted to alternating upper and lower case characters.
s = $, l = 7, e
= 3, i = !, g = 6, o = 0
Example:
blogspot.com
= blog%spot
= b706%SpOt
3. If the domain
has an odd number of letters, split the domain into two, replace the middle
character with '_', transpose the second set of letters using the table above
and the first set of letters are converted to alternating upper and lower case
characters.
Example:
microsoft.com
= micr_soft
= MiCr_$0ft
The task is to
determine the passwords for each of the web-site on the list. The list is
provided as a text file, with each site listed on each line.
|
Input |
Output |
|
ibm.com http://jedi.dev.java.net hotmail.com http://www.pldtplay.com/gameservers.php |
Case #1:
9AbCmM Case #2:
jA1CvM1 Case #3:
HoT_a!7 Case #4:
p7dt%PlAy |