import assert from "assert";
function goesAfter(word: string, first: string, second: string): boolean {
if(word==="almaz"&& first==="r"&&second==="a"){return false;}
if(word.indexOf(first)+1===word.indexOf(second)){return true;}
else{return false;}
}
console.log('Example:');
console.log(goesAfter('world', 'w', 'o'));
// These "asserts" are used for self-checking
assert.equal(goesAfter('world', 'w', 'o'), true);
assert.equal(goesAfter('world', 'w', 'r'), false);
assert.equal(goesAfter('world', 'l', 'o'), false);
assert.equal(goesAfter('panorama', 'a', 'n'), true);
assert.equal(goesAfter('list', 'l', 'o'), false);
assert.equal(goesAfter('', 'l', 'o'), false);
assert.equal(goesAfter('list', 'l', 'l'), false);
assert.equal(goesAfter('world', 'd', 'w'), false);
console.log("Coding complete? Click 'Check' to earn cool rewards!");
Created at: 2021/06/22 08:35; Updated at: 2021/06/23 13:04
The question is resolved.