var str = readline().trim(); // readline() , 从控制台读取数据
var length = str.length;
var ch, index = 0;
while(index < length) {
ch = str[length - (index + 1)];
if (ch === ' ') {
break;
}
index++;
}
console.log(index)
var str = readline().trim(); // readline() , 从控制台读取数据
var length = str.length;
var ch, index = 0;
while(index < length) {
ch = str[length - (index + 1)];
if (ch === ' ') {
break;
}
index++;
}
console.log(index)