,[[[-<+>>>+<<]>-[---<+>]<[[-<]>>]<[-]>>[<<,>>>[-[-<++++++++++>]]++++<[->+<]-[----->-<]<]<]>>>[[>>]+[-<<]>>[[>>]+[<<]>>-]]+[>>]<[-]<[<<]>[->[>>]<+<[<<]>]>[>.>]+[>[-]<,.[->+>+<<]>>----------]<[<<]>-<<<,]
온라인으로 사용해보십시오!
입력 끝에 줄 바꿈이 필요합니다. 이 요구 사항이없는 버전은 6 바이트 더 깁니다.
,[[[-<+>>>+<<]>-[---<+>]<[[-<]>>]<[-]>>[<<,>>>[-[-<++++++++++>]]++++<[->+<]-[----->-<]<]<]>>>[[>>]+[-<<]>>[[>>]+[<<]>>-]]+[>>]<[-]<[<<]>[->[>>]<+<[<<]>]>[>.>]+[>[-]<,[->+>+<<]>>[----------<.<]>>]<[<<]>-<<<,]
온라인으로 사용해보십시오!
두 버전 모두 모든 숫자가 255보다 작다고 가정합니다.
설명
테이프는 다음과 같이 배치됩니다.
tempinputcopy 85 0 inputcopy number 1 a 1 a 1 r 1 d 0 w 0 o 0 l 0 f 0 ...
숫자가 입력되지 않으면 "숫자"셀은 0이되고, 숫자 n이 입력되면 n + 1이됩니다. "85"로 표시된 셀에서 입력이 이루어집니다.
,[ take input and start main loop
[ start number input loop
[-<+>>>+<<] copy input to tempinputcopy and inputcopy
>-[---<+>] put the number 85 in the cell where input was taken
<[[-<]>>] test whether input is less than 85; ending position depends on result of comparison
(note that digits are 48 through 57 while letters are 97 through 122)
<[-]> clean up by zeroing out the cell that didn't already become zero
>[ if input was a digit:
<<,>> get next input character
>[-[-<++++++++++>]] multiply current value by 10 and add to current input
++++ set number cell to 4 (as part of subtracting 47)
<[->+<] add input plus 10*number back to number cell
-[----->-<] subtract 51
<] move to cell we would be at if input were a letter
<] move to input cell; this is occupied iff input was a digit
part 2: update/output word
>>> move to number cell
[ if occupied (number was input):
[>>]+[-<<]>> remove existing marker 1s and decrement number cell to true value
[[>>]+[<<]>>-] create the correct amount of marker 1s
]
+[>>]<[-] zero out cell containing next letter from previous word
<[<<]> return to inputcopy
[->[>>]<+<[<<]>] move input copy to next letter cell
>[>.>] output word so far
+[ do until newline is read:
>[-]< zero out letter cell
,. input and output next letter or newline
[->+>+<<] copy to letter cell and following cell
>>---------- subtract 10 to compare to newline
]
<[<<]>- zero out number cell (which was 1 to make copy loop shorter)
<<<, return to input cell and take input
] repeat until end of input
0
앞0
의 숫자를 제외한 숫자가 없다고 가정 할 수 있습니까?