Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 4
    I'm not really sure this is on-topic here. But regarding your first approach - if you don't like concatenating so much, why are you bothering with remembering the current longest word, rather than its start and end position? Commented Mar 11, 2019 at 11:47
  • 1
    Note that your examples should reset currentWord when the find a space, rather than when they mark something as longer Commented Mar 11, 2019 at 12:02
  • Is this homework? Commented Mar 11, 2019 at 13:20
  • 2
    You're essentially just reimplementing string.split. How is that really accomplishing anything with the artificial requirement not to use it? Commented Mar 11, 2019 at 15:21
  • 2
    Let me give you some doesn't-answer-the-question advice: Just about every language's standard library has functions for doing these things. They're well-solved problems and often available in source form. If you want to know how they've been implemented by the more-experinced, study them. Commented Mar 11, 2019 at 15:22