Created
August 19, 2020 07:22
-
-
Save RP-3/a748aa00226c1d4d705137be010526ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} S | |
* @return {string} | |
*/ | |
const v = 'aeiouAEIOU'; | |
var toGoatLatin = function(S) { | |
return S.split(' ') | |
.map((w, i) => (v.indexOf(w[0]) >= 0 ? w : (w.slice(1) + w[0])) + 'ma' + 'a'.repeat(i+1)) | |
.join(' '); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment