1. 

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, WS10/11
* Problem: 10424 Love Calculator
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=16&page=show_problem&problem=1365
*
* @author Fabian Liebl
* @version 1.0, 10/06/2010
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.104
*/

import java.io.*;

public class Main {

private static int getValue(String s) {
int value = 0;
char c;
for (int i = 0; i < s.length(); i++) {
c = s.charAt(i);
if ((c >= 'a') && (c <= 'z'))
{
value += c - 96;
}
if ((c >= 'A') && (c <= 'Z')) {
value += c - 64;
}
}
return value;
}

private static int getCrossSum(int i) {
int x = i;
int value = 0;
while (x > 0) {
value += x % 10;
x = x / 10;
}
return value;
}

public static void main(String[] args) throws IOException {
BufferedReader inputReader = new BufferedReader(new InputStreamReader(System.in));

String name1, name2;
int name1Value, name2Value;
double love;

while (true) {
name1 = inputReader.readLine();
if (name1 == null) {
// EOF
return;
}
name2 = inputReader.readLine();

name1Value = getValue(name1);
name2Value = getValue(name2);

while (name1Value > 9) {
name1Value = getCrossSum(name1Value);
}
while (name2Value > 9) {
name2Value = getCrossSum(name2Value);
}

if (name1Value > name2Value) {
love = (double) name2Value / (double) name1Value;
} else {
love = (double) name1Value / (double) name2Value;
}

System.out.printf("%.2f %%\n", love*100);
}
}

}