What's in a name?
..Or rather, what's a name in? For us, a particular string is where we are looking for a name.

Task

Test whether or not the string contains all of the letters which spell a given name, in order.

The format
A function passing two strings, searching for one (the name) within the other.
``function nameInStr(str, name){ return true || false }``

Examples

    nameInStr("Across the rivers", "chris") --> true
                ^      ^  ^^   ^
                c      h  ri   s
                
    Contains all of the letters in "chris", in order.
----------------------------------------------------------
    nameInStr("Next to a lake", "chris") --> false
    
    Contains none of the letters in "chris".
--------------------------------------------------------------------
    nameInStr("Under a sea", "chris") --> false
                   ^   ^
                   r   s
                   
    Contains only some of the letters in "chris".
--------------------------------------------------------------------
    nameInStr("A crew that boards the ship", "chris") --> false
                 cr    h              s i
                 cr                h  s i  
                 c     h      r       s i
                 ...
                 
    Contains all of the letters in "chris", but not in order.
--------------------------------------------------------------------
    nameInStr("A live son", "Allison") --> false
               ^ ^^   ^^^
               A li   son
                 
    Contains all of the correct letters in "Allison", in order, 
    but not enough of all of them (missing an 'l').
    

Note: testing will _not_ be case-sensitive.

Difficulty: introductory

Starter code:

def name_in_str(str, name):
	

Solutions:
def name_in_str(str, name):
    it = iter(str.lower())
    return all(c in it for c in name.lower())

def name_in_str(text, name):
    for c in text.lower():
        if c == name[0].lower():
            name = name[1:]
            if not name:
                return True
    return False

def name_in_str(str, name):
    str = str.lower()
    name = name.lower()
    
    for n in name:
        try:
            ix = str.index(n)
            str = str[ix+1:]
        except:
            return False
    return True

from re import search; name_in_str=lambda s,n: search(".*".join(list(n)),s,2) != None

def name_in_str(strng, name):
  strng = strng.lower()
  for letter in name.lower():
    if letter not in strng:
      return False
    else:
      strng=strng[strng.find(letter)+1:]
  return True
    


import re
def name_in_str(s, name):
    str_lst=re.findall('[a-z]',s.lower())
    i=0
    for c in name.lower():
        if not c in str_lst:
            return False
        else:
            i=str_lst.index(c)
            str_lst=str_lst[i+1:]
    return True

def name_in_str(s, name):
    s = s.lower()
    name = name.lower()
    result = False
    x = 0
    helper = []

    for i in range(len(name)):
        for j in range(x, len(s)):
            if name[i] == s[j]:
                x = j + 1
                helper.append(name[i])
                break

    if list(name) == helper:
        result = True

    return result

def name_in_str(str, name):
    name = list(reversed(name.lower()))
    for c in str.lower():
        if c == name[-1]: name.pop()
        if not name: return True
    return False

def name_in_str(s, word):
    i,word,t = 0,word.lower(),""
    for j in s.lower():
        if word[i] == j : t += j ; i += 1
        if t == word : return True
    return False

def name_in_str(str, name):
    name = list(name.lower())[::-1]
    charFind = name.pop();
    for x in str.lower():
        if(x == charFind):
            if(len(name) == 0):
                return True;
            charFind = name.pop();
    return False;