Skip to content

Instantly share code, notes, and snippets.

@anishmashankar
Created April 1, 2015 05:26
Show Gist options
  • Save anishmashankar/46254147ec9f63bcfcbd to your computer and use it in GitHub Desktop.
Save anishmashankar/46254147ec9f63bcfcbd to your computer and use it in GitHub Desktop.
import sys
text = "Virat Kohli has stayed in the shadows even as India knocked off all their six group-stage opponents to reach the quarter-finals of the World Cup. After his 107 against Pakistan in their opening game at the Adelaide Oval, Kohli managed another 194 runs from the next five matches, without a single fifty to his name. He aggregates 301 and does not even find a place in the top-10 run-scorers in the tournament. However, West Indian legend Brian Lara felt the Indian batting mainstay will deliver once the World Cup gets into the business-end from this week"
#words = set(text.split(" "))
words = ['ced','ted','med','red','rai','rwq','ren','rem']
to_find = raw_input()
first_list = []
found=False
for word in words:
if len(word) == len(to_find):
first_list.append(word)
print first_list
for i in range(0,len(to_find)+1):
for word in first_list:
if word[:i+1] != to_find[:i+1]:
first_list.pop(first_list.index(word))
print first_list
if len(first_list) != 1:
print 'not found'
else:
print 'found'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment