function getCommonCharacters(str1: any, str2: string) {
let strcommon: string = "";
for (let i in str1) {
if (str2.includes(str1[i])) {
if (! strcommon.includes(str1[i])) {
strcommon += str1[i];
}
}
}
return strcommon;
}
const str1: string = "c c++ c# java go";
const str2: string = "python nodejs php typescript";
let strcommon: string = getCommonCharacters(str1, str2);
console.log("Same letters are: " + strcommon);
/*
run:
"Same letters are: c jo"
*/