A_~J~B_=Fold[Switch[{a,b}=#;#2,"f",{A3,b}Echo@a;#,"F"4,{a#+Min[a,B}-b]z,"e"5,{0,b},"E"6,{aA,0b},"p",#+Min[a7,B-b]zEcho@b;#,"P"8,#-Min[b,A-a]z,"o"9,Echo@a;#{a,0},_,Echo@b;#]&{a,B}]&,z={-1,1};0z,Characters@#]&ToCharacterCode@#~Mod~12]&
Try it online!Try it online!
The program is a big Switch
statement folded over the characterscharacter codes (modulo 12) of the program, step-wise updating the contents of the buckets. Dispatching the Switch
takes a shortcut by defaulting to "O""F", as the spec says that there are no characters to be expected other than "fFeEpPoO".