SP11267 KL11B - Arnook Defensive Line
Description
Based on the latest intelligence reports, Chief Arnook of the northern tribe has become suspicious of the warrior nations that dwell south of the border. The chief has ordered his warriors to protect the southern border which runs parallel to the 54 $ ^{o} $ latitude line and stretches between the longitudes of 1 $ ^{o} $ to 1000,000,000 $ ^{o} $ , inclusive.
Each warrior is assigned the task of protecting a segment of the border defined to lie between longitudes “a” and “b”, inclusive. No two warriors are assigned to protect the exact same segment. Bound by loyalty to his chief, a warrior will inform the chief upon his arrival at his appointed post and will never leave once he arrives.
Your task is to write a program that performs the following two operations to help Chief Arnook track the status of his border protection.
Input Format
N/A
Output Format
There is one output line for each input line that starts with the operation “?”. The output consists of a single integer that represents the number of warriors who completely protect the corresponding segment at the time.
There is no output for input lines that start with the character “+”.