function encode(string) {
string = string.toUpperCase();
let a = string.split(``);
a = a.filter(function (char) {
if (char.charCodeAt(0) < 65) {
return false;
} else if (char.charCodeAt(0) > 90) {
return false;
} else {
return true;
}
});
a.forEach(function (item, index, arr) {
arr[index] = item.charCodeAt(0) - 65;
});
return a;
}