Dcoder icon

Finding Nemo @ Dcoder

By Lochard | As a newbie programmer | 3 Apr 2023


Problem: Nemo is a little kid in Word-World who always gets mixed in a group of other words and gets lost. Marlin and Coral (Nemo's parents) are quite desperate and called you for help every time Nemo got lost. You helped for the first few times but got irritated when you were called upon again and again. So write an algorithm that would do your work for you. You will be given a group of words. You need to find 'Nemo' among these words and print its position.

Input: First line contains N, the number of words.
The next line contains N space-separated words.
Output: Print the position of the word 'Nemo' in the group.
Constraints: 1 ≤ N ≤ 1000
1 ≤ word.length ≤ 50
Sample Input: 6
This is a Nemo sample input
Sample Output:
4

input()
print(input().split().index('Nemo') + 1)

How do you rate this article?

2


Lochard
Lochard

20240228 Arrived in the UK for about 2 week. All my fears persist. Some are even getting worse. https://github.com/locharp/asylum_diary/


As a newbie programmer
As a newbie programmer

Sharing entry level codes. My snippets on GitHub https://github.com/locharp/code-snippets

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.