Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[pull] master from youngyangyang04:master #460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
pull merged 6 commits into AlgorithmAndLeetCode:master from youngyangyang04:master
Jun 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
添加0053.替换数字.md PHP版本
  • Loading branch information
KyDestroy committed Jun 6, 2024
commit f96b0cf776e3ea6c06bf1e2471a5822437f973c9
37 changes: 35 additions & 2 deletions problems/kamacoder/0054.替换数字.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,43 @@ main();

### Scala:


### PHP:

```php
<?php
// 标准输入
$s = trim(fgets(STDIN));
$oldLen = strlen($s);
$count = 0;
for ($i = 0; $i < $oldLen; $i++) {
if (is_numeric($s[$i])) {
$count++;
}
}

// 扩充字符串
$s = str_pad($s, $oldLen + $count * 5);
$newLen = strlen($s);
while($oldLen >= 0) {
if (is_numeric($s[$oldLen])) {
$s[$newLen--] = 'r';
$s[$newLen--] = 'e';
$s[$newLen--] = 'b';
$s[$newLen--] = 'm';
$s[$newLen--] = 'u';
$s[$newLen--] = 'n';
} else {
$s[$newLen--] = $s[$oldLen];
}
$oldLen--;
}

echo $s;
?>
```




### Rust:

Expand All @@ -381,4 +415,3 @@ main();
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a>

AltStyle によって変換されたページ (->オリジナル) /