Имя: Пароль: Зарегистрироваться Восстановить пароль
30/11/2023 00:20:33

Рабочее место участника

Задачи

1376. Love Calculator

Ограничения: время – 500ms/1000ms, память – 64MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод
Послать решение Blockly Посылки Темы Где Обсудить (0)

Alice had found the way to calculate the love between two persons, in her elder sister's notebook. Since mathematics is too complex for Alice, you will have to write a program so that Alice can calculate love between any two persons very quickly.
You will be given two names. These two names can have white space or some other non-alphabetical characters like \$ @ & % etc. Each character has a particular value. Letters L, V, and E have value 9, letters Y, O, and U – 12, other characters – 0. Both upper case and lower case holds the same values. The love strength is calculated in percents as the difference between the sum of letters' values in both names and the half-sum of names' lengths. Remember: result can not be more than 100% and less than 0%.
The input contains two lines. Each line contains the name, which holds not more than 30 characters.
Your program have to calculate the love between these two persons and print the result in percents with one digit after the decimal point.

Sample Input

Romeo Montague
Juliet Capulet


Sample Output

100.0%

The sum of letters' values in "Romeo Montague" is 12+9+12+12+12+9=66
The sum of letters' values in "Juliet Capulet" is 12+9+9+12+9+9=60
The love strength is 66+60-(14+14)/2=112% -> 100%