Task Description: Implement the Beautiful String Cost Calculation Function
You are required to implement a function named calculate_beautiful_string_cost which computes the minimum number of character changes needed to transform specified substrings of a given string s into "beautiful" strings. A "beautiful" string in this context is defined as one that alternates between the characters 'a', 'b', and 'c' in any order, repeating every three characters.
A string s (1 <= |s| <= 10^5) consisting of lowercase letters from the alphabet.
Input Parameter queries:
A list of tuples queries, each containing two integers (l, r) where 1 <= l <= r <= |s|. This indicates that you should evaluate the substring from index l to r (inclusive, 1-based indexing).
Output Requirements
The function should return a list of integers, where each integer corresponds to the minimum number of changes required to transform each queried substring into a "beautiful" string.
Implementation Instructions
Create a new file named /app/solution.py.
Implement the function calculate_beautiful_string_cost within this file, adhering to the provided function signature.
The function should make use of permutations to generate all possible "beautiful" patterns of the strings "abc".
The implementation should efficiently handle the constraints provided, especially for longer strings and multiple queries (up to 10^5).
Make sure to thoroughly test your implementation with various inputs to ensure its correctness and efficiency.