There are N cities in a country. From any city i, you can spend 1 USD to travel to any city, such that:If A is 'U', then j must be greater than i.• If A, is 'D', then j must be less than g.You are given the string A of length N. It is possible that you have to travel through multiple paths to reach your destination.Let Cost(i, j) represent the minimum USDs needed to complete the journey from city i to city j.Print the sum of Cost(1,3) for all the ordered pairs (1,7)Note: The input is provided in such a way that you can travel from one city to another city,Input formatThe first line contains string A.Output formatin a single line print the answer to the problem,Constraints1<A < 10% where A denotes the length of string AString consists of characters U' and 'D' onlySample InputUDSample Output2
Answers
Answered by
1
Answer:
2343223
Explanation:
qqqqqqqqqqqqqqq
Similar questions