const { count } = require("console");

function Main(input){
    input = input.split("\n");
    sLine = input[0].split("");
    tLine = input[1].split("");
    let sNum = sLine.length;
    let tNum = tLine.length;

    let matList = new Array;

    for(n=0; n < tNum; n++){
        let kioku = 0;
        let counter = 0
        for(s=0; s < sNum; s++){
            let matting = tLine[n] == sLine[s]? true: false;
            if(matting){
                matList.push(sLine[s]);
                counter++;
                kioku = s;
                /*if(n > 0 && kioku == n - 1){
                    counter--;
                }*/
                break;
            }else if(!matting){
                if(s == sNum){
                    matList.push(tLine[n]);
                    counter++;
                    break;
                }
            }
        }
        console.log(counter);
    }
}   
Main(require("fs").readFileSync("/dev/stdin", "utf8"));