#T424. 查找元素

查找元素

Description

Try to write an algorithm that searches for a number in a singly linked list with a head node.

If found, the function should return the position of the number in the list (i [1~n]);

If not found, the function should return 0.

Input Format

First line: the original sequence;

Second line: the number to search for

Output Format

If found, output the position of the number in the sequence (the first position is 1, and so on)

If not found, output 0

```input1 2 3 4 5 6 7 8 9 5 ``` ```output1 4 ``` ## Hint

Use the linear list method

No solution available yet. AC program

Source

CodesOnline