Basically I have been assigned to translate one language to another as follows:
there is an input motion that represents what should be done in what order. "/" marks the end of one action. For example:
a//3d/// means "a" should be pressed in the first time spot, nothing in the second, and "d" should be held down for the final 3 time spots. However, I must translate that input motion into some output instructions in a different form. The instructions for this motion would be a.DDD (period signaling a non-action and capitalization meaning holding a letter).
Another example: w/W/w/S/ translates to the instructions wwws
One "/" must be used for every time spot even if no action is done or a letter is being held for that spot.
The first function I am to use is:
bool isMotionMeaningful(string motion)
This should test whether or not the motion input has any actual output. For example, 3d/a/0s/ is nonsense because there are not enough "/" for the ending of each D hold time spot and 0s is meaningless.
My first thought was using string::find to search motion for possible bad inputs but I don't think this would be a reasonable way go about it. Also we have not covered this function in class (only covered boolean, functions, arrays, a few others).
I'm not looking for a solution by any means but does anyone have any suggestions for what I can try to at least get started with diagnosing whether the string is meaningful? I only have a couple weeks of coding experience and this problem has had me stumped for hours.