Amazon Online Assessment 2021 (OA) - Decode String Frequency

Amazon Web Services (AWS) is working on a new security feature to help encode text. Consider a string that consists of lowercase English alphabetic letters (i.e., [a-z]) only. The following rules are used to encode all of its characters into string s:

This is a companion discussion topic for the original entry at