function checkNumberOfLetters(str) {
const splitedStr = str.trim().split('');
const charCout = splitedStr.reduce((acc, curr) => {
acc[curr] = (acc[curr] || 0) + 1;
return acc;
}, {});
for (const [key, value] of Object.entries(charCout)) {
if (value === 2) {
return str;
}
}
return null;
}
ZnVuY3Rpb24gY2hlY2tOdW1iZXJPZkxldHRlcnMoc3RyKSB7CiAgY29uc3Qgc3BsaXRlZFN0ciA9IHN0ci50cmltKCkuc3BsaXQoJycpOwoKICBjb25zdCBjaGFyQ291dCA9IHNwbGl0ZWRTdHIucmVkdWNlKChhY2MsIGN1cnIpID0+IHsKICAgIGFjY1tjdXJyXSA9IChhY2NbY3Vycl0gfHwgMCkgKyAxOwoKICAgIHJldHVybiBhY2M7CiAgfSwge30pOwoKICBmb3IgKGNvbnN0IFtrZXksIHZhbHVlXSBvZiBPYmplY3QuZW50cmllcyhjaGFyQ291dCkpIHsKICAgIGlmICh2YWx1ZSA9PT0gMikgewogICAgICByZXR1cm4gc3RyOwogICAgfQogIH0KCiAgcmV0dXJuIG51bGw7Cn0=