#K47882. File Versioning System
File Versioning System
File Versioning System
You are given a sequence of operations representing file version changes. The operations include "increment" which increases the version by 1, and "rollback" which decreases the version by 1, but only if the version is greater than 1. The file system initially starts at version 1. Your task is to determine the final version of the file after performing all the operations.
The input starts with an integer n which is provided for compatibility but is not used in the computation. Then follows an integer m representing the number of operations, followed by m lines each containing an operation. Make sure you simulate the operations from top to bottom.
The expected output is the final version of the file.
inputFormat
The first line contains an integer n (this parameter is not used in the computation). The second line contains an integer m, representing the number of operations. The following m lines each contain a single operation, which is either "increment" or "rollback".
outputFormat
Output a single integer — the final version of the file after processing all the operations.
## sample5
5
increment
increment
rollback
increment
rollback
2