: ** ( n1 n2 -- n1 ** n2 ) 1 swap 0 do swap dup rot * loop nip ; : "monthab" c" Januarias FebruariasMartias Apriles Maias Junias Julias Augustas SeptembresOctobres Novembres Decembres Januarias " ; : monthab 10 * "monthab" 1+ + 10 type space ; : monthab 0 max 12 min monthab ; : "romnine" c" IXXCCM" ; : romnine 2 * "romnine" 1+ + 2 type ; : romnine 0 max 2 min romnine ; : "romfour" c" IVXLCD" ; : romfour 2 * "romfour" 1+ + 2 type ; : romfour 0 max 2 min romfour ; : "romfive" c" VLD" ; : romfive "romfive" 1+ + 1 type ; : romfive 0 max 2 min romfive ; : "romunit" c" IXCM" ; : romunit "romunit" 1+ + 1 type ; : romunit 0 max 3 min romunit ; : romplace ( power u -- ) dup 9 = if over romnine 2drop else dup 4 = if over romfour 2drop else dup 4 > if over romfive 5 - then dup if 0 do romunit loop else 2drop then then then ; : thousands 0 do ." M" loop ; : hundreds dup 9 = if ." CM" drop else dup 4 = if ." CD" drop else dup 4 > if ." D" 5 - then dup if 0 do ." C" loop else drop then then then ; : tens dup 9 = if ." XC" drop else dup 4 = if ." XL" drop else dup 4 > if ." L" 5 - then dup if 0 do ." X" loop else drop then then then ; : ones dup 9 = if ." IX" drop else dup 4 = if ." IV" drop else dup 4 > if ." V" 5 - then dup if 0 do ." I" loop else drop then then then ; : romnum ( u -- ) 1000 /mod dup if thousands else drop then 100 /mod dup if hundreds else drop then 10 /mod dup if tens else drop then dup if ones else drop then space ; : romnum ( u -- ) 3 0 do 10 i ** /mod dup if i swap romplace else drop then loop space ; : romnum 1 max 3999 min romnum ;