| Contests - ACM Student Chapter - PSUT |
|---|
| Private |
| Spectator |
Abu Jawdat wants to conduct a population census for the residents of Haret Al-Dhabe3, So Abu Jawdat gathered his men from the police station and went to the houses to find out the names of the men and women in each household.
While collecting the names, he met Abu Hatem to ask about his daughters' names (Ya baaateeel shoooo). Abu Hatem responded, "The oldest one's name is mart el 3ageed Abo Shehab."
After Abu Jawdat recorded the names of the residents of Haret Al-Dhabe3, he wants to enter these names into the computer to be stored in the database owned by ElFrensawi (Ya baaateeel).
The problem is that the system only accepts names in English, so Abu Jawdat translated the names and used lowercase English letters, numbers, and the underscore _ symbol to represent the full name of each individual.
Abu Jawdat now needs to enter the translated names. To do this, he has a keyboard with all the English letters, numbers, and the underscore _ symbol.
Additionally, there is an "erase" button, which will delete the last character.
The program developed by the French for Abu Jawdat is very simple. It contains:
Abu Jawdat types the name in the text box and then presses save to store the name in the French database.
When the save button is pressed, the text box remains unchanged, and the name that was written stays without being cleared. Note that the "save" button is not a keyboard button.
There is a rule that after he finishes saving the names, he should erase the last name so the text box becomes empty, then he can close the program.
Abu Jawdat can enter the names in any order he wants because they will be arranged automatically in the database. Abu Jawdat is very lazy and wants to enter all the names with the fewest clicks on the keyboard.
Can you help Abu Jawdat by telling him what is the minimum number of clicks he needs to make to store all the names and close the program?
The first line will contain one integer $$$n$$$ $$$(1 \leq n \leq 10^5)$$$ — denotes is the population of Haret Al-Dhabe3.
For the next $$$n$$$ lines, the $$$i_{th}$$$ line will contain a string $$$s_i$$$, which represents the translation of the name of the $$$i_{th}$$$ resident.
Each character in $$$s_i$$$ will be a lowercase English letter, or a digit between '0' and '9' or the character underscore _ and the length of $$$s_i$$$ will not exceed 30.
Print the minimum number of keyboard clicks Abu Jawdat needs to make in order to save all the names.
5shareefehhameedehiftikarnawalmo6ee3ah
74
4abu_hatemabu_basheerabu_5a6erabu_3esam
52
43esamme3tazbasheer5a6er
46
2abcabd
8
5shareefehhameedehiftikarnawalmo6ee3ah
74
4abu_hatemabu_basheerabu_5a6erabu_3esam
52
43esamme3tazbasheer5a6er
46
2abcabd
8
The following image shows a better visualization of the first example

In the fourth sample:
He will save in the order $$$abc$$$, $$$abd$$$
The clicks are $$$[a , b , c , save , erase, d , save, erase, erase, erase]$$$

| Name |
|---|

