Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.039 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; '(python': 0.05; 'finished': 0.15; 'exceed.': 0.16; 'expression.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'stdin': 0.16; 'subject:Regular': 0.16; 'subject:expression': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'trying': 0.21; 'subject:problem': 0.22; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'wrote': 0.26; 'am,': 0.27; '2.6': 0.27; 'message- id:@mail.gmail.com': 0.27; 'regular': 0.27; 'run': 0.28; 'code': 0.31; 'could': 0.32; 'getting': 0.33; '11,': 0.33; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'test': 0.36; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'your': 0.60; 'solve': 0.62; 'limit': 0.65; '2013': 0.84; 'limit?': 0.84; 'windows)': 0.84; 'faster.': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=TXid8Z2Cf7DJTTKNSSHAzYqFT8xRR0NN00P7oxoKwTo=; b=u35rBwluUi79DZuEPzaTfN3gqqlxBy5FfE0FbyPeAuJNPpUOi9mztobBbeqnYAvRtr PNLe6f8MwO2nKMzI+vWqEvy9NEmDnWK3gqsIy1d8Rz/9VJTJfGs1KO/m01jNWM8LmdEY qz96uZ7KsR2fV+RUHs+2vfGmfdPvJc3NpVXBMnpfJaJ1eOudbbaJQs2s6ZuPC1OpUc79 ujrh9URMiy8oFwwO8iBA20ETNd0oDFgRA22i0JdLQZxilIcbDsutPC/CEFqOQYG2uVZw mhRmlFhRZ+nW+Ww5vMbLUuZtrAmujmFm8q6flf9hF36zlHgyAc81DwTYvepYmB4Xapfp qXZg== MIME-Version: 1.0 X-Received: by 10.52.22.194 with SMTP id g2mr3264068vdf.91.1362938399171; Sun, 10 Mar 2013 10:59:59 -0700 (PDT) In-Reply-To: References: Date: Mon, 11 Mar 2013 04:59:59 +1100 Subject: Re: Regular expression problem From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362938407 news.xs4all.nl 6975 [2001:888:2000:d::a6]:44506 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41025 On Mon, Mar 11, 2013 at 4:42 AM, mukesh tiwari wrote: > I am trying to solve this problem[1] using regular expression. I wrote this code but I am getting time limit exceed. Could some one please tell me how to make this code run faster. What is the time limit? I just tried it (Python 2.6 under Windows) and it finished in a humanly-immeasurable amount of time. Are you sure that STDIN (eg raw_input()) is where your test data is coming from? ChrisA