Brainfuck, 179 bytes
++++++++++[-[<<+>>-]+<<]>,[<[-]-[>-<-----]>++[-[>>+<<-]>>]>+++[<<],>,]<[,>>---[> >]<<+++[<<]]>->>->>>>->>>>>>->[[>>]>,<<+[++[>+++++++++++<-]<+]>>[++.>-.>]>++++++ ++++[>>]<<[.[<]<]<] Formatted:
++++++++++ [ -[<<+>>-] +<< ] >, [ <[-] -[>-<-----] >++ [ -[>>+<<-] >> ] >+++[<<] ,>, ] < [ ,>>---[>>] <<+++[<<] ] >->>->>>>->>>>>>-> [ [>>] >,< <+ [ ++[>+++++++++++<-] <+ ] >>[++.>-.>] >++++++++++[>>] <<[.[<]<] < ] Expects input without a trailing newline.
The tape is initialised with ten nodes, each of which contains a one followed by a zero. The one is the initial value of the pin, and the zero facilitates navigation and acts as a placeholder for the space character. For each number in the input, that pin is incremented by 3; note that ord('O') - ord('.') = 33, and during the printing phase, the pin's value will be multiplied by 11. (This multiplication is also used to generate the space character.) The order of the pins from left to right on the tape is simply 1 up to 10. If the input ends with a 1010, a correction is made, since the 1010 is initially treated as a 11.
After the input has been processed, a negative one is placed after each row. Then the rows are processed one by oneprinted in a loop, with the number of leading spaces determined by the number of rows previously processed.