vector<string> Generate(string s) {
if(s.length() == 1) return {s};
vector<string> ans;
last = s.back();
s = s.substring(0,s.length()-1);
vector<string> prev = Generate(s);
for (const string &entry : prev) {
ans.push_back(entry + last);
ans.push_back(entry + "." + last);
}
return ans;
}
function Generate(s) {
if(s.length === 1) return [s];
const ans = [];
const last = s[s.length - 1];
s = s.slice(0, s.length - 1);
const prev = Generate(s);
for (const entry of prev) {
ans.push(entry + last);
ans.push(entry + '.' + last);
}
return ans;
}