回答編集履歴

1

1

2021/11/19 12:04

投稿

takasima20
takasima20

スコア7464

test CHANGED
@@ -31,3 +31,39 @@
31
31
  }
32
32
 
33
33
  ```
34
+
35
+ --- 追記 ---
36
+
37
+ 参考までにこっちも
38
+
39
+ ```javascript
40
+
41
+ function restore(str) {
42
+
43
+ let n = ""
44
+
45
+ let r = ""
46
+
47
+ const nums = "0123456789"
48
+
49
+ for (let i=0;i<str.length;i++) {
50
+
51
+ if (nums.includes(str[i])) {
52
+
53
+ n += str[i] + ""
54
+
55
+ } else {
56
+
57
+ r += str[i].repeat(n * 1)
58
+
59
+ n = ""
60
+
61
+ }
62
+
63
+ }
64
+
65
+ return r
66
+
67
+ }
68
+
69
+ ```