Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.163 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.67; '*S*': 0.00; 'key.': 0.09; 'repeated': 0.09; 'python': 0.11; 'examples:': 0.16; 'received:cu': 0.16; 'truncate': 0.16; 'wrote:': 0.18; 'subject:need': 0.19; 'foundation': 0.20; '(the': 0.22; 'example.': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'character': 0.29; 'characters': 0.30; 'url:mailman': 0.30; 'received:10.0.0': 0.31; "skip:' 10": 0.31; 'ok.': 0.31; 'work:': 0.31; 'text': 0.33; 'url:python': 0.33; 'header:Received:9': 0.33; 'url:listinfo': 0.36; 'received:10.0': 0.36; 'url:org': 0.36; 'received:10': 0.37; 'to:addr:python-list': 0.38; 'fact': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'url:mail': 0.40; 'how': 0.40; 'received:unknown': 0.61; 'length': 0.61; 'no.': 0.61; 'entire': 0.61; 'first': 0.61; 'times': 0.62; "you'll": 0.62; 'email addr:gmail.com': 0.63; 'line,': 0.68; 'received:200': 0.72; 'repeat': 0.74; 'escuela': 0.84; 'iii': 0.84; 'url:cu': 0.84 X-Amavis-Modified: Mail body modified (using disclaimer) - xmail2.uci.cu X-Virus-Scanned: amavisd-new at xmail2.uci.cu Date: Wed, 5 Nov 2014 13:05:15 -0500 (CST) From: "C@rlos" To: python-list@python.org In-Reply-To: <545A6413.1060608@mrabarnett.plus.com> Subject: Re: I need algorithm for my task MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5573719_116518097.1415210715669" X-Mailer: Zimbra 8.0.5_GA_5839 (ZimbraWebClient - FF29 (Linux)/8.0.5_GA_5839) Thread-Topic: I need algorithm for my task Thread-Index: 1nH75q0cmJQe+gs9O7cUVvXGZFfxrQ== X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 90 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415210732 news.xs4all.nl 2839 [2001:888:2000:d::a6]:47864 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80288 ------=_Part_5573719_116518097.1415210715669 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit I thing this work: stg='pythonpython' foundationline=stg[ 0:( stg [ 1: ].index( stg[ 0 ])+1 ) ] On 2014-11-05 11:58, lordvital21@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. > Consider the first example. If the foundation is the first 1 character 'p' and you repeat it enough times you'll get 'pppppppppppppppp'. This is the same length as the line. Does it match the line? No. OK. If the foundation is the first 2 characters 'py' and you repeat it enough times you'll get 'pypypypypypypypy'. This is the same length as the line. Does it match the line? No. OK. If the foundation is the first 3 characters 'py' and you repeat it enough times you'll get 'pytpytpytpytpytpyt'. This is longer than as the line, so truncate it to 'pytpytpytpytpytpy'. Does it match the line? No. OK. Continue in this vein until you'll get a match. (The foundation might in fact be the entire line.) -- https://mail.python.org/mailman/listinfo/python-list III Escuela Internacional de Invierno en la UCI del 17 al 28 de febrero del 2014. Ver www.uci.cu ------=_Part_5573719_116518097.1415210715669 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
I thing this work:

<= /div>stg=3D'pythonpython'
foundationline=3Dstg[ 0:( stg [ 1: ].index( st= g[ 0 ])+1 ) ]

On 2014-11-05 11:58, lordvital21= @gmail.com wrote:
> I have line 'pythonpythonpyth'. How do I know whi= ch word is the foundation line?.
> Other examples:
> "pythonpyt= honpyth" 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.=
>
Consider the first example.

If the= foundation is the first 1 character 'p' and you repeat it enough
times = you'll get 'pppppppppppppppp'.

This is the sam= e length as the line.

Does it match the line? = No.

OK.

If the fo= undation is the first 2 characters 'py' and you repeat it
enough times y= ou'll get 'pypypypypypypypy'.

This is the same= length as the line.

Does it match the line? N= o.

OK.

If the fou= ndation is the first 3 characters 'py' and you repeat it
enough times yo= u'll get 'pytpytpytpytpytpyt'.

This is longer = than as the line, so truncate it to 'pytpytpytpytpytpy'.

=
Does it match the line? No.

OK.
=

Continue in this vein until you'll get a match. (= The foundation might
in fact be the entire line.)

--
https://mail.python.org/mailman/listinfo/python-list

=

III Escuela Internacional de Invierno en la UCI del 17 al 28 de febrero del 2014. Ver www.uci.cu =0A
= ------=_Part_5573719_116518097.1415210715669--