Task Description: Implement Bus Access Arbitration Function
Functionality:
You need to implement a function arbitrate_bus_access that determines which master gets access to a bus based on their request priorities. The function checks which master requests access first and only grants bus access to that master, while all others are denied.
Input/Output Requirements:
Input:
A string inp of length n consisting of characters '0' and '1'. Each character represents a request from masters where:
'1' means the master requests access to the bus.
'0' means the master does not request access.
An integer n, representing the length of the inp string.
Output:
A string of length n where only the first master (the leftmost '1' in the inp string) that requests access is granted bus access. This is represented by '1' at the index of the first '1' in inp, while all other indices contain '0'.
If there are no requests (no '1' in inp), the output should be a string of '0's of length n.
Example:
Input: arbitrate_bus_access("00101", 5)
Output: "00100"
Input: arbitrate_bus_access("00000", 5)
Output: "00000"
Implementation:
Your solution must be implemented in a file named /app/solution.py. Ensure that the function signature and behavior match the description provided.