Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

IF there are 2 persons(A,B) starting at Zero ,start position may be indicated as

ID: 3625902 • Letter: I

Question

IF there are 2 persons(A,B) starting at Zero ,start position may be indicated as A 0 , B 0.Suppose they move on a number line from 0 to 100.

They have to move to certain destination to which they are directed.The work is a sequencial job ,so A and B has to coordinate in such a way.After completing the task , they both EAT for 1 sec. simultaneoulsy.In 1 second A and B each move 1 unit(their speed)

For example :
If a command A 5,B 0,A 4,B 5 IS given

A has to start from 0 and move to interger 5 on the number line ,it takes 5 seconds ,eventhough B's command is starting position after only A finishes its first task B will EAT i.e., first A,B start from rest (A moves to 5( 5 seconds)|| B waits there for 5 seconds(Because B's task is initial position it self),then A and B EAT for 1 sec .Now (A moves to 4 (Takes only 1 second to move from 5 to 4 )and wait for 4 seconds for B to complete|| In these 5 seconds B moves to 5),Then A and B eat for 1 second.

Aim:To calculate the time required to complete the task list(minimum time) { final Eating time is also included)

CAUTION: NUMBER LINE IS ONLY UPTO 100 THAT IS POSITION >= B 101 OR A 101IS NOT VALID

Input:

Number of Task codes(cases)(N) in a line N<=10

Task codes each in each line

Output

case#x:time:?

for all cases

Example:
Input :

3

A 5,B 0,A 4,B 2

A 4 B 1,A 7B 3, A 2 B 100

A 6,B 10, A 5 B 3

OUTPUT:
CASE 1 : ?

CASE2:(ANSWER)

CASE3:(ANSWER)

Explanation / Answer

Cool man you can just download the answer from google summer code :)