Pages

Bangladeshi Blog

Friday, January 14, 2011

7757. Flowers Flourish from France

code:
while True: 
    line = str(raw_input()) 
    if line == '*': 
        break 

    s = [x.lower() for x in line] 

    # Removing leading spaces 
    while s: 
        temp = s.pop(0) 
        if temp != ' ': 
            s.insert(0, temp) 
            break 
         
    # Removing trailing spaces 
    while s: 
        temp = s.pop() 
        if temp != ' ': 
            s.append(temp) 
            break 

     
    check = s.pop(0) 
    ls = len(s) 
    i = 0 
    flag = True 
     
    while i < ls: 
        if s[i] == ' ': 
            if s[i+1] == check: 
                flag = True 
                i += 2 
            else: 
                flag = False 
                break 
        else: 
            i += 1 

    if flag: 
        print 'Y' 
    else: 
        print 'N' 

## End of Source Code
Be Pythonic

1 comment:

gabriellejackyl said...

Harrah's Reno - Mapyro
Find Harrah's Reno, 전라북도 출장샵 Nevada (Nevada) 정읍 출장샵 location with 논산 출장안마 realtime driving directions, live traffic updates and road conditions – from 13 제주 출장안마 nearby 남원 출장마사지 airports.

Post a Comment