I have a task where I need to read input and check if that input occurs in some words. For example:

```
Who are your friends? Fred Bill Sue Simone
What is the message? Should you make tea?
Sue could have written this.

```

It prints "Sue could have written this because the letters "S", "U" and "E" appear in the each consecutive word. Another example is:

```
Who are your friends? James Nicky Jake
What is the message? join and make enough cash today!
James could have written this.
Jake could have written this.

```

Both names are printed because both of their letters appear consecutively in each word. I have the following code:

```
friends = input("Who are your friends? ").split()
message = input("What is the message? ").split()

name = []
other = []

for friend in friends:
  for f in friend.lower():
    for word in message:
      print("checking if", f, "is in", word.lower())
      if f in word.lower():
        print("Adding", f, " to name list")
        name.append(f)
        break
      else:
        other.append(f)
        continue

joinedResult = ''.join(name)

for person in friends:
  if person.lower() in joinedResult:
    print(person, "could have written this.")

```

It works perfect for the first example, but for the second example it prints all three names:

```
James could have written this.
Nicky could have written this.
Jake could have written this.

```

I have learnt that the code does not check if the letters in the name appear **consecutively**, rather it checks if the name is in any word. How do i solve this?