B. Following the String | Codeforces Round 923 (Div. 3) | Codeforces | Full solution with code

Published --