#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
double scoreIT(string s){
int score[26] = {};
double total = 0;
transform(s.begin(), s.end(), s.begin(), ::tolower);
for(int i = 0; i < s.length(); i++){
if(s[i] >= 'a' && s[i] <= 'z'){
int index = s[i] - 'a';
score[index]++;
}
}
for(int i = 0; i < 26; i++){
if(score[i] > 0){
cout << "score " << score[i] << endl;
total += ((i + 1) * score[i]);
cout << "total " << total << endl;
}
}
cout << "total " << total << endl;
return total;
}
int main(){
string first, second;
while(cin >> first >> second){
double score1 = scoreIT(first);
double score2 = scoreIT(second);
double total = 0;
if(score1 >= score2){
total = score2/score1;
} else {
total = score1/score2;
}
//total *= 1000.0;
cout << total << endl;
}
return 0;
}