const str: string = "c# c c++ php typescript python go";
const halfstr = str.substring(0, (Math.floor(str.length / 2) + 1));
const center = halfstr.lastIndexOf(' ') + 1;
const parts = [str.substring(0, center), str.substring(center)];
console.log(parts[0]);
console.log(parts[1]);
/*
run:
"c# c c++ php "
"typescript python go"
*/