Prázdny
Prázdny

Task 1

Login required

Buggy – Master Password Manager

 

This is an almost real story about a programmer Buggy who works for a successful IT company.

 

When one day Buggy decided to change his passwords, he made three mistakes when entering the new password into the security program and thus blocked his account.

 

To unlock his account, he needed to know his strongest password, the master password. But it was such a long string of characters that it was impossible to remember. Moreover, it was a password that he did not have to enter anywhere in practice to unblock his account. Since he didn't remember it, he had a trick for this situation. He prepared his own algorithm to obtain the password. But he had to program it first to get to the final password, because he was never a fan of keeping such information in the classic format.

He used a matrix of characters, where each character had its own coordinate in the matrix. The matrix of characters was 8x8 in size and contained the numbers from 0 to 9, followed by the alphabet with lowercase letters, then with uppercase letters, and finally the special characters comma and dot. The only thing that Buggy has physically preserved are the coordinates of the characters from which words could be composed, necessary for the subsequent compilation of his master password.

The coordinates consisted of row + column pairs, according to which it is possible to find the necessary characters in the matrix, which make up words separated by a comma.

Since breaking such encryption using coordinates is basically an easy task for anyone who has the matrix and the list of coordinates of the characters in the matrix, the resulting string did not represent his master password yet.

 

The string he got so far are just the words separated by commas. The trick that had to be done after decryption is to shorten the string by joining words. Combining words has its own rule: if the end of the first word contains the same characters as the beginning of the next word, then the next word must be shortened by these characters and the rest of the second word must be joined to the previous one. This step removes special character (commas or dot) at the same time. For example, when the first word is " data-cke-survive="1" data-cke-survive="1"lemON" followed by the word "onion", the result should be "lemONion". If adjacent words have no character crossing, nothing is removed except the special character between the words. Case does not matter when comparing characters, so "on" = "On" = "oN". If there is an overlap of the same characters, characters from the second word are always removed, not from the first.

 

When Buggy finally managed to get the final chain, the security system had 2 more control questions ready. He needed to answer a control question to enter the total number of characters that were removed after applying his algorithm (special characters such as dot and comma are not included in the count) and also to enter the longest string of characters that was removed (case-sensitive).

 

Since several years have passed since this event, Buggy has already said goodbye to a similar password storage and encryption strategy and moved on to more reliable methods. However, he is still interested in how many programmers would be able to guess his password, assuming they got the coordinates.

 

 

Therefore, the output of your task is:
• write down the password itself
• the number of characters that were removed after applying the algorithm (special characters such as dots and commas are not included in the number)
• and the longest string of characters that was removed (case-sensitive)
• at the end, attach the code that you used to create the password

 

 

Example:
Input file:
{{1,2},{3,1},{3,1},{2,5},{1,6},{7,6},{2,5},{1,6},{ 2,6},{3,0},{2,7},{7,6},{3,0},{2,7},{2,2},{3,0},{2, 7}};

Matrix:
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,.";

 

Inter result:
"apple, lemon, onion"
(Counting starts with 0. Position {1,2} means 2. row and 3. column.)

 

 

Output:
Password: "applemonion"
Deleted strigs: "leon"
The longest deleted string: "le"

TXT FILE FOR DOWNLOAD

 

SOLUTION HERE