#K86132. Simulate a Basic File System
Simulate a Basic File System
Simulate a Basic File System
In this problem, you are asked to implement a basic file system that supports two operations: create and get. The create operation adds or updates a file at a specified path with a given value, while the get operation retrieves the file's contents. If the file does not exist, output (\text{not found}).
The operations will be provided via standard input, and your program should output the results of all get operations to standard output, each on its own line.
inputFormat
The first line of input contains an integer (n), representing the number of operations. The following (n) lines each contain an operation. An operation is one of the following two types:
- create <path> <value>
: Create or update a file at the given path
with the provided value
.
- get <path>
: Retrieve the value of the file at the given path
. If the file does not exist, output not found
.
outputFormat
For each get
operation, print the result on a separate line to standard output. If the file does not exist, print not found
.## sample
5
create /a/b/c hello
create /a/b/d world
get /a/b/c
get /a/b/d
get /a/b/e
hello
world
not found
</p>