package com.thinker.bishi.saima;

import java.util.Scanner;

/**
 * @author lzh
 * <p href="http://exercise.acmcoder.com/online/online_judge_ques?ques_id=1677&konwledgeId=134">
 *     http://exercise.acmcoder.com/online/online_judge_ques?ques_id=1677&konwledgeId=134
 * </p>
 *
 */
public class YueDeEr {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String firstLine = in.nextLine();
        String secondLine = in.nextLine();
        firstLine = change(firstLine);
        System.out.printf("%.2f%%",check(firstLine.toCharArray(),secondLine.toCharArray()));
    }

    private static double check(char[] firstLine,char[] secondLine){
        double result = firstLine.length;
        int count = 0;
        for(int i=0;i<firstLine.length;i++){
            if(firstLine[i] == secondLine[i])
                count ++;
        }
        result = count*100/result;
        return result;
    }
    private static String change(String firstLine){
        char[] tmps = firstLine.toCharArray();
        for(int i=0;i<firstLine.length();i++){
            int tmp = (int)tmps[i];
            if((tmp >=48 && tmp <= 57) || (tmp >=65 && tmp <= 90) || (tmp >=97 && tmp <= 122)){
                tmps[i] = (char)(1+48);
            }else {
                tmps[i] = (char)(48);
            }
        }
        return new String(tmps);
    }

}
