Skip to content

Instantly share code, notes, and snippets.

@ChousinRahit
Created September 3, 2023 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChousinRahit/08d1f226e2817b11ae694e4bb23114f4 to your computer and use it in GitHub Desktop.
Save ChousinRahit/08d1f226e2817b11ae694e4bb23114f4 to your computer and use it in GitHub Desktop.
// Stretched Words
// Write a function that takes a string, and returns a new string with any duplicate consecutive letters removed.
// Examples
// unstretch("ppoeemm") ➞ "poem"
// unstretch("wiiiinnnnd") ➞ "wind"
// unstretch("ttiiitllleeee") ➞ "title"
// unstretch("cccccaaarrrbbonnnnn") ➞ "carbon"
// Notes
// Final strings won't include words with double letters (e.g. "passing", "lottery").
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment