#K8391. Maximum Cars in City
Maximum Cars in City
Maximum Cars in City
The city of Metropolis has installed a state‐of‐the‐art surveillance system that logs every car entering and leaving the city. Each record consists of a license plate number and an action, either "enter" or "leave". Your task is to determine the maximum number of cars present in the city at any moment as the records are processed in chronological order. Note that the current number of cars is updated as
when a car enters or leaves respectively.
inputFormat
The input begins with an integer T denoting the number of test cases. For each test case, the first line contains an integer N representing the number of records. This is followed by N lines, each containing a license plate and an action (either "enter" or "leave") separated by a space.
outputFormat
For each test case, output a single integer representing the maximum number of cars present in the city at any given moment. Each result should be printed on a new line.
## sample1
7
ABC123 enter
XYZ789 enter
ABC123 leave
DEF456 enter
XYZ789 leave
DEF456 leave
GHI012 enter
2
</p>