Cannot create algorithm for decidable language L2 = {<M> : M is a TM and there exists an input string w such that M halts within 10 steps on input w}

Hi. I am creating an algorithm to show above L2 is decidable.
And the hint is given as following:

To show L2 is decidable, test given TM M on all input strings of
  length at most 10, each for 10 steps. Note that there are finitely
  many such strings to test, so this algorithm will always terminate. If
  M halts on any input string w within 10 steps then let w' be the
  prefix of w of length
  10. M will also halt on input w' within 10 steps, so the decision algorithm described above will find it.

I just can't understand this hint.
M(w)
 let w be w1,w2,... such that w=w1,w2,...,wn
 for i=1,2,...,10
  run m on wi for 10 steps
  if it accepts
   let w' be prefix of w of length 10 and w' be w1,w2,... such that w'=w'1,w'2,...,w'n
   for t=1,2,...,10
    run m on w't for 10 steps
   end for
  end if
 end for
end M(W) 

As you see above algorithm I made, I have no idea to make proper algorithm from those L2 defnition and hint above.
I need help on writing it correctly (please use your style of writing an algorithm. I don't think the style doesn't matter if the main idea is correct. What I do not get is its idea.)
Thank you very much if you can help me.

The hint you are given is pretty much the answer. Note first that in $10$ steps, any TM can read at most $10$ symbols from the input. Hence we need only consider the strings of length 10, because if the TM reads more than the first 10 symbols, then we know it can not have halted within ten steps. Given your alphabet $\Sigma$, the set $\Sigma^*_{\leq 10}$ of strings of length at most 10 is a finite set. Hence the algorithm is as follows, given a TM $M$ as input.


*

*For all $w \in \Sigma^*_{\leq 10}$, run $M$ on $w$ for $10$ steps.

*If $M$ halts on any of the $w \in \Sigma^*_{\leq 10}$, then accept, otherwise reject.

