Skip to content

Latest commit

 

History

History
26 lines (24 loc) · 429 Bytes

challenge3.md

File metadata and controls

26 lines (24 loc) · 429 Bytes
var result = [];
var dictionary = {
	'277': 'app',
	'27753': 'apple',
	'227': ['bar', 'car'],
	'344': ['dig', 'fig'],
	'364': 'dog',
	'7223': 'race',
	'733': 'red',
	'763': 'rod',
	'92837': 'water'
};
    
for (var key in dictionary) {
	if (S.length <= key.length) {
		if (key.startsWith(S))
			result.push(dictionary[key]);
	} else {
		if (S.startsWith(key))
			result.push(dictionary[key]);
	}
}

return result.join();