Some of the keys of Ajith's Laptop's Keyboard are damaged and he is not able to type those keys. He has to complete his assignment and submit it the next day and since it is midnight he will not be able to give his laptop for repair. So he decides to make a character sequence of all the damaged keys in a sequence that he can copy and paste and make a word out of them. Ajith needs to type a paragraph with all the characters in lower case. Help Ajith to find out the best permutation of the sequence of the characters (corresponding to the damaged keys) per word, that can be used while typing the paragraph, i.e. the sequence that will require least insertion and deletion while typing a word. Consider paste operation to be of one keystroke. Ignore the copy operation. Recursively apply the same procedure for all the words in the paragraph. This way you will get the best combination that should be selected for that word. Finally, how many different words exist per character sequence combination. The combination that is the best for maximum words should be printed as output. If there are more than one candidates for best character sequence print the lexicographically smallest character sequence. Refer the example section for better understanding. Constraints 0 < Number of words in paragraph < 50 0 < Number of damaged keys <= 6 Input First line contains the paragraph P that is to be written Second line contains the characters that represent the damaged keys Output One Line containing the best string which can be used to copy paste for the words. Time Limit 1 Examples Example 1 Input supreme court is the highest judicial court s u Output su Explanation There are two possible combinations of the damaged keys i.e. either su or us. For word supreme, su is suitable as it requires only paste operation For court, us is suitable as it requires less keystrokes for deletion Similarly, for is, su is suitable and so on Finally, we get su suitable for words supreme, is and highest and us suitable for words court (twice) and judicial. We get su and us suitable for 3 words each. Since su is lexicographically smaller than us. So, the output will be su. Example 2 Input ginnestinggin gniinginging n i g Output gin Explanation There are six possible combinations of the damaged keys i.e. {nig, ngi, ing, ign, gni, gin}. For the first word, gin sequence requires least keystrokes for insertion and deletion. Similarly, for the second word ing sequence requires least keystrokes. Since both are eligible for best sequence, we will need to output the lexicographically smaller string. So, the output will be gin.
Answers
Answer:
have a similar problem with the keyboard of an Inspiron 11 3147 model. The following keys only work intermittently after tapping them several times: ESC, ~,TAB, CAPS, 1, Q, A, and Z. The laptop was 14 months old, just out of warranty, when we noticed the issue. I called DELL support just to check what my options were and some joker there quoted me $349 Canadian dollars for the repair.
Before putting this piece of junk in the garbage I decided to spend some time and take a look at the problem myself. My first step was to make sure it wasn’t a software issue. Uninstalling and reinstalling drivers and trying different BIOS versions did not make any difference. It was not a software problem.
Next step was to determine which part of the hardware was failing. I checked the keyboard controller IC, motherboard traces, keyboard connector on the motherboard and the keyboard module itself. It turned out to be the keyboard module itself. There is a broken trace inside the keyboard connected to pin 16 on the keyboard connector. In the process of troubleshooting the issue I ended up mapping every key to the corresponding pin pair on the keyboard connector. The keyboard connector is a 26-pin connector with pin 1 being the closest to the battery. Below is a list of the intermittent keys and the corresponding two pins that get connected when pressing on the keys:
ESC 16-26
~ 16-18
TAB 16-19
CAPS 16-15
1 16-24
Q 16-25
A 16-22
Z 16-21
As you can see what is common between these keys is that they are all connected to pin 16 of the keyboard connector. Obviously that trace on the flex board (some people call it membrane) or an electrical via is broken. Unfortunately the keyboard module cannot be repaired without completely taking it apart but then it will be much easier to just replace it with a new one instead of repairing it.
I haven’t replaced the keyboard yet. I am not sure if it is worth the time and effort. For those of you who decide to replace the keyboard I recommend checking the new one before installing it. Just use a multimeter to measure the resistance between the corresponding pins while pressing on a key. The resistance should be about 200 ohm. You may need a helper to press the key while you are holding the multimeter probes on the connector pins.
I don’t know about you but I personally will never buy another DELL product again. From what I have seen inside this laptop it so obvious that the designers at DELL have absolutely no clue of what they are doing.