File tree Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -369,9 +369,43 @@ main();
369
369
370
370
### Scala:
371
371
372
-
373
372
### PHP:
374
373
374
+ ``` php
375
+ <?php
376
+ // 标准输入
377
+ $s = trim(fgets(STDIN));
378
+ $oldLen = strlen($s);
379
+ $count = 0;
380
+ for ($i = 0; $i < $oldLen; $i++) {
381
+ if (is_numeric($s[$i])) {
382
+ $count++;
383
+ }
384
+ }
385
+
386
+ // 扩充字符串
387
+ $s = str_pad($s, $oldLen + $count * 5);
388
+ $newLen = strlen($s);
389
+ while($oldLen >= 0) {
390
+ if (is_numeric($s[$oldLen])) {
391
+ $s[$newLen--] = 'r';
392
+ $s[$newLen--] = 'e';
393
+ $s[$newLen--] = 'b';
394
+ $s[$newLen--] = 'm';
395
+ $s[$newLen--] = 'u';
396
+ $s[$newLen--] = 'n';
397
+ } else {
398
+ $s[$newLen--] = $s[$oldLen];
399
+ }
400
+ $oldLen--;
401
+ }
402
+
403
+ echo $s;
404
+ ?>
405
+ ```
406
+
407
+
408
+
375
409
376
410
### Rust:
377
411
@@ -381,4 +415,3 @@ main();
381
415
<a href =" https://programmercarl.com/other/kstar.html " target =" _blank " >
382
416
<img src =" ../pics/网站星球宣传海报.jpg " width =" 1000 " />
383
417
</a >
384
-
You can’t perform that action at this time.
0 commit comments