function solution(string) {
if (string.length % 2 === 0) {
const half = string.length / 2;
return string[half - 1] + string[half];
} else {
const half = string.length / 2;
return string[Math.floor(half)];
}
}
console.log(solution("abcde"));
console.log(solution("qwer"));