Tom the lumberjack is going to do his daily routine: chop trees. After all, it's his job to do so. His boss has ordered him to chop trees in a straight line marked with a special tape to identify them, so he knows which trees he is going to have to chop. However, Tom quickly realizes he has a problem. His axe will only chop so much wood before breaking, and he forgot to bring a spare with him. Plus, the trees are different sizes. A small tree, marked with an
i, will take 2 swings of the axe to chop, and a large tree, marked with an
| will take 4 swings. Can Tom chop all of the assigned trees?
Given two inputs, a string that determines the sequence of small and large trees and an integer that determines the durability of the axe, create a program that determines not only if Tom's axe will break or not, but also determine how many of each tree type he chopped down. It's code-golf, so the shortest code in bytes wins!
Input 1 example:
i||iii| This input string determines the sequence of trees.
Input 2 example:
50 This input integer determines the durability of the axe.
The outputs for this particular example will be a boolean and a string as follows(True means Tom's axe broke):
4 small, 3 big