CJam、72バイト
"zzubzzif":MaqN/:Q,_F+{)_[Z5]f%:!MW%4/.*s\e|}%ew{:sQ1$A,sff&:s.e|=}=N*o;
zzubzzifを出力する必要がある場合、プログラムはエラーで終了します。
Javaインタープリターを使用すると、STDERRを閉じて、最終的なエラーメッセージを抑制することができます。CJamインタープリターでプログラムを試行する場合、最初の行の後のすべての出力を無視します。
使い方
"zzubzzif" e# Push that string.
:Ma e# Save it in M and wrap in in an array.
qN/:Q e# Split the input into lines and save in Q.
,_F+ e# Count the lines and add 15 to a copy of the result.
{ e# For each integer I between 0 and lines+14:
)_ e# Increment I and push a copy.
[Z5] e# Push [3 5].
f% e# Map % to push [(I+1)%3 (I+1)%5].
:! e# Apply logical NOT to each remainder.
MW%4/ e# Push ["fizz" "buzz"].
.* e# Vectorized string repetition.
s\ e# Flatten the result and swap it with I+1.
e| e# Logical OR; if `s' pushed an empty string, replace it with I+1.
}% e#
ew e# Push the overlapping slices of length "lines".
{ e# Find; for each slice:
:s e# Cast its elements to string (e.g., 1 -> "1").
Q1$ e# Push the input and a copy of the slice.
A,s e# Push "0123456789".
ff& e# Intersect the slice's strings' characters with that string.
:s e# Cast the results to string. This replaces "fizz", "buzz"
e# and "fizzbuzz" with empty strings.
.e| e# Vectorized logical OR; replace empty lines of the input
e# with the corresponding elements of the slice.
= e# Check the original slice and the modified input for equality.
}= e# Push the first match or nothing.
e# We now have ["zzubzzif"] and possibly a solution on the stack.
N* e# Join the topmost stack item, separating by linefeeds.
o e# Print the result.
; e# Discard the remaining stack item, if any.