Task Description: Count ABC Subsequences in a String
Functionality:
Implement the function count_abc_subsequences(s: str, mod: int = 10**9 + 7) -> int that counts the number of subsequences in a given string s that match the pattern "abc". The string may contain characters 'a', 'b', 'c', and '?'. The '?' character can represent any of 'a', 'b', or 'c', and the function should account for all possible replacements of '?' when counting subsequences.
Input Requirements:
The function accepts two parameters:
s (1 <= |s| <= 1,000): a string consisting of characters 'a', 'b', 'c', and '?'.
mod (1 <= mod <= 10^9 + 7): an optional integer representing the modulus for the result. Default value is (10^9 + 7).
Output Requirements:
The function should return an integer representing the total number of subsequences that form the pattern "abc" modulo mod.
Implementation Notes:
Handle all characters in the string, including processing the '?' character to consider all three possibilities for it.
Use dynamic programming principles to efficiently keep track of counts of 'a', 'ab', and 'abc' as the string is traversed.
File Requirement:
The solution must be implemented in a file called /app/solution.py.