[Careercup] 17.14 unconcatenate Words broken Words

Source: Internet
Author: User

17.14 Oh, no! You had just completed a lengthy document when you had an unfortunate find/replace mishap. You are accidentally removed all spaces, punctuation, and capitalization in the document. A sentence like "I Reset the computer. It still didn ' t boot! "would become" iresetthecomputeritstilldidntboot ". You can add the punctation and capitalization later, once you get the individual words properly SE Parated. Most of the words would be in a dictionary, but some strings, like proper names, would not.

Given A dictionary (a list of words), design an algorithm to find the optimal of the "unconcatenating" a sequence of words . In this case, "optimal" are defined to be the parsing which minimizes the number of unrecognized sequences of characters.

For example, the string "Jesslookedjustliketimherbrother" would is optimally parsed as "JESS looked just like TIM she Brot Her. " This parsing has seven unrecognized characters, which we had capitalized for clarity.

[Careercup] 17.14 unconcatenate Words broken Words

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.