Given a string s, encode it such that its encoded length is the shortest, using the rule k[encoded_string] (the inner string repeated k times). Return the length of the shortest possible encoding. Encoding is only beneficial when it shortens the string.
Input: A quoted string s.
Output: Integer — shortest encoded length.
Input: "aaaaaaaaaa"
Output: 5
Explanation: '10[a]' has length 5.Input: "aaa"
Output: 3
Explanation: Encoding doesn't help.Input: "abbbabbbcabbbabbbc"
Output: 11
Explanation: Best nested encoding.1<=s.length<=150