About the role
A photography set consists of π cells in a row, numbered from 1 to π in order, and can be represented by a string πΆ of length π. Each cell π is one of the following types (indicated by πΆπ, the πth character of πΆ):
If πΆπ = "P", it is allowed to contain a photographer
If πΆπ = "A", it is allowed to contain an actor
If πΆπ = "B", it is allowed to contain a backdrop
If πΆπ = ".", it must be left empty
A photograph consists of a photographer, an actor, and a backdrop, such that each of them is placed in a valid cell, and such that the actor is between the photographer and the backdrop. Such a photograph is considered artistic if the distance between the photographer and the actor is between π and π cells (inclusive), and the distance between the actor and the backdrop is also between π and π cells (inclusive). The distance between cells π and π is β£πβπβ£ (the absolute value of the difference between their indices).
Determine the number of different artistic photographs which could potentially be taken at the set. Two photographs are considered different if they involve a different photographer cell, actor cell, and/or backdrop cell.
About the company
Meta builds technologies that help people connect, find communities, and grow businesses. When Facebook launched in 2004, it changed the way people connect. Apps like Messenger, Instagram and WhatsApp further empowered billions around the world. Now, Meta is moving beyond 2D screens toward immersive experiences like augmented and virtual reality to help build the next evolution in social technology.