#T627. 查找元素

查找元素

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 address (position i [1~n]) of the number in the list;

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 output as 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