Ad
  • Custom User Avatar

    The ternary operator is redundant in this case

  • Custom User Avatar

    Hi Robin479,
    Regarding your first observation you are right, there might be cases that a sentence starts with a space. As of your second observation there is no point writing code for every kind of possibility, I don't think that this is the purpose of this kata. If we wanted to deepen the problem we could write a compiler from scratch! Either way thank you for your comment.

  • Custom User Avatar

    Your loop starts on the third character. You're algorithm will fail on input like " this sentence has a leading space." You're code will also fail on input like "this sentence uses no‑break‑spaces instead of regular spaces."