Ad
  • Custom User Avatar

    Vim shortcuts?

    Submit code: :w
    Run examples: ???

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    On that note,

    I'd suggest this test case:

    input = '1234567890123456789012345 12345678901234567890123451 2345678901234567890123';
    expectedResult = '1234567890123456789012345\n123456789012345678901234-\n51 2345678901234567890123'
    Test.expect(wordWrap(input) == expectedResult)

  • Custom User Avatar

    I don't think the fifth case really matters for a strict 25-char limit per line--there isn't a difference between the rendered lines.

    On the other hand, removing the whitespace at the beginning of a line might let it be rendered on a single line instead of two.