#C11008. Set Operations Queries
Set Operations Queries
Set Operations Queries
You are given a sequence of operations to be performed on a set of integers. There are three types of operations:
add x
: Insert the integer \(x\) into the set.remove x
: Remove the integer \(x\) from the set if it exists (do nothing otherwise).query x
: Check whether the integer \(x\) is present in the set. For this operation, output "True" if \(x\) is in the set and "False" otherwise.
The operations are processed sequentially; when a query
operation is encountered, the result should be output immediately.
Note: All operations will be read from standard input, and all the outputs for query operations should be printed to standard output.
inputFormat
The first line of input contains an integer \(T\) representing the number of operations. The next \(T\) lines each contain an operation in one of the following forms:
add x
remove x
query x
Here, \(x\) is an integer.
outputFormat
For each query
operation, print a single line containing either "True" or "False" depending on whether \(x\) exists in the set at that point in the sequence of operations.
5
add 1
add 2
query 1
remove 1
query 1
True
False
</p>