给定一个字符串式子,返回它的计算结果。算术规则为: k*[encoded_string],表示其中方括号内部的 encoded_string 正好重复 k 次。注意 k 保证为正整数。e.g. s = "3*[a2*[c]]", 返回 “accaccacc”
示例1
输入
"3*[a2*[c]]"
输出
"accaccacc"
加载中...
import java.util.*; public class Solution { /** * * @param str string字符串 * @return string字符串 */ public String computeString (String str) { // write code here } }
class Solution { public: /** * * @param str string字符串 * @return string字符串 */ string computeString(string str) { // write code here } };
# # # @param str string字符串 # @return string字符串 # class Solution: def computeString(self , str ): # write code here
/** * * @param str string字符串 * @return string字符串 */ function computeString( str ) { // write code here } module.exports = { computeString : computeString };
# # # @param str string字符串 # @return string字符串 # class Solution: def computeString(self , str ): # write code here
package main /** * * @param str string字符串 * @return string字符串 */ func computeString( str string ) string { // write code here }
/** * * @param str string字符串 * @return string字符串 */ char* computeString(char* str ) { // write code here }
"3*[a2*[c]]"
"accaccacc"