๐ก T๊ฐ S๊ฐ ๋ ์ ์๋์ง ์๊ฐํ๋ฉด ์ฝ๊ฒ ํ ์ ์๋ค. ์ด ๋ฐฉ๋ฒ์ ์๊ฐํ๋๊ฒ ์๊ฐ์ด ์ข ๊ฑธ๋ ธ๋ค.๐
const fs = require('fs');
const [S, T] = fs.readFileSync('/dev/stdin').toString().trim().split('\n');
let temp = T.split("");
while (S.length !== temp.length) {
if (temp[temp.length - 1] === "A") {
temp.pop();
} else {
temp.pop();
temp = temp.reverse();
}
}
if (S === temp.join("")) {
console.log(1);
} else {
console.log(0);
}