Já que realmente precisava ser feito, aqui está. Foi realmente desagradável depurar e forneceu alguns desafios.
A entrada deve conter apenas letras maiúsculas. A saída é unária (espero que esteja tudo bem?)
J K ZZZZZZK Z ZD ZB ZZZZZZZZZZZZZZZZZA K A Z ZD ZB ZZZZZZZZZZZZZZZKF K A Z ZD ZB ZZZZZZZZZZZZZZZB K A Z ZD ZB ZZZZZZZZZZZZZZZ K A Z ZD ZB ZZZZZZZZZZZZZZKD K A Z ZD ZB ZZZZZZZZZZZZZD K A Z ZD ZB ZZZZZZZZZZZZZD K A Z ZD ZB ZZZZZZZZZZZZ K A Z ZD ZB ZZZZZZZZZZZZB K A Z ZD ZB ZZZZZZZZZKA K A Z ZD ZB ZZZZZZZZZKF K A Z ZD ZB ZZZZZZZZZZK K A Z ZD ZB ZZZZZZZZZB K A Z ZD ZB ZZZZZZZZZB K A Z ZD ZB ZZZZZZZZKD K A Z ZD ZB ZZZZZZZK K A Z ZD ZB ZZZZKB K A Z ZD ZB ZZZZZZKF K A Z ZD ZB ZZZZZZB K A Z ZD ZB ZZZZZFB K A Z ZD ZB ZZZZZA K A Z ZD ZB ZZZAK K A Z ZD ZB ZZZ K A Z ZD ZB ZD K A Z ZD ZB ZKB K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K A ZKA ZZZZZZZZZZZZZZZZZZY
Experimente online!
O processo geral é:
- obter caractere da entrada
- subtrair 65
- verifique se o resultado é 0
- se 0 pular quantidade especificada de palavras.
- caso contrário, subtraia 1 e repita a verificação.
- os alvos de salto são operações de impressão push seguidas, um retorno ao início do programa.
Termina com um erro.
Uma explicação mais completa:
J K ZZZZZZK Z ZD # Get input and subtract 65
ZB ZZZZZZZZZZZZZZZZZA K A Z ZD # Character A - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZZZKF K A Z ZD # Character B - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZZZB K A Z ZD # Character C - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZZZ K A Z ZD # Character D - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZZKD K A Z ZD # Character E - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZD K A Z ZD # Character F - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZD K A Z ZD # Character G - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZ K A Z ZD # Character H - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZB K A Z ZD # Character I - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZKA K A Z ZD # Character J - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZKF K A Z ZD # Character K - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZK K A Z ZD # Character L - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZB K A Z ZD # Character M - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZB K A Z ZD # Character N - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZKD K A Z ZD # Character O - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZK K A Z ZD # Character P - if 0 jump to print, otherwise subtract 1
ZB ZZZZKB K A Z ZD # Character Q - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZKF K A Z ZD # Character R - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZB K A Z ZD # Character S - if 0 jump to print, otherwise subtract 1
ZB ZZZZZFB K A Z ZD # Character T - if 0 jump to print, otherwise subtract 1
ZB ZZZZZA K A Z ZD # Character U - if 0 jump to print, otherwise subtract 1
ZB ZZZAK K A Z ZD # Character V - if 0 jump to print, otherwise subtract 1
ZB ZZZ K A Z ZD # Character W - if 0 jump to print, otherwise subtract 1
ZB ZD K A Z ZD # Character X - if 0 jump to print, otherwise subtract 1
ZB ZKB # Character Y - if 0 jump to print, otherwise subtract 1
K ZZZZKF KF # Jump Point for print 1111111111
K ZZZZKF KF #
K ZZZZKF KF # Jump Point for print 11111111
K ZZZZKF KF #
K ZZZZKF KF #
K ZZZZKF KF # Jump Point for print 11111
K ZZZZKF KF # Jump Point for print 1111
K ZZZZKF KF # Jump Point for print 111
K ZZZZKF KF # Jump Point for print 11
K ZZZZKF KF # Jump Point for print 1
K A ZKA ZZZZZZZZZZZZZZZZZZAAAA # Jump back to start