lordvita...@gmail.com wrote: > I have line 'pythonpythonpyth'. How do I know which word is the foundation > line?. Other examples: > "pythonpythonpyth" is python > "DOLORIUMD" is DOLORIUM > "HELLOLHELLO" is HELLOL > "thewordword" is thewordword > > I need to know whether the word in the text is repeated and get it. This > will be the key.
A simple approach that might work (I didn't implement it to verify): Look for other occurences of the first letter. If there are none you have the "foundation", if there are any, split the line before them and check if the rest of the line can be constructed as a (possibly truncated) repetition of the beginning. For fifafofifaf you'd have to check fi fafofifaf --> false fifa fofifaf --> false fifafo fifaf --> true so we don't care about fifafofi faf fifafofifa f -- https://mail.python.org/mailman/listinfo/python-list