Building Suffix Array from Suffix Tree. Inorder visit when node has more than two children
If a node has $l$ children, with $l \geq 2$ during the inorder visit you have to treat the first $l-1$ children as left nodes, and you have to visit the parent multiple ($l-1$) times, writing multiple times the length of the prefix spelled inside the lcp array.
This, applied to the tree in the image, would yield the correct:
SA = [7, 6, 4, 2, 1, 5, 3]
lcp = [0, 1, 3, 0, 0, 2]

keeping in mind that the edge labeled &quot;$&quot; with the leaf 7 should be the leftmost.