```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ``` ```def morse(str,morse) decode_array = [["A","._"],["B","_..."],["C","_._."],["D","_.."],["E","."],["F",".._."],["G","__."],["H","...."],["I",".."],["J",".___"],["K","_._"],["L","._.."],["M","__"],["N","_."],["O","___"],["P",".__."],["Q",".._."],["R","._."],["S","..."],["T","_"],["U",".._"],["V","..._"],["W",".__"],["X","_.._"],["Y","_.__"],["Z","__.."],["1",".____"],["2","..___"],["3","...__"],["4","...._"],["5","....."],["6","_...."],["7","__..."],["8","___.."],["9","____."],["10","_____"]] n_arr = [] if morse == true str = str.split(" ") for i in str p = 0 while p < decode_array.length if i == decode_array[p][1] n_arr << decode_array[p][0] << " " end p += 1 end end else str = str.split(//) for i in str p = 0 while p < decode_array.length if i == decode_array[p][0] n_arr << decode_array[p][1] << " " end p += 1 end end end return n_arr.join end puts morse("S O S",false) ```
 ```1 ``` ```... ___ ... ```