Skip to content

Commit b7c540c

Browse files
authored
feat: add php solution to lc problem: No.1957 (doocs#1015)
1 parent 1c5edd5 commit b7c540c

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

solution/1900-1999/1957.Delete Characters to Make Fancy String/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,25 @@ func makeFancyString(s string) string {
126126
}
127127
```
128128

129+
### **PHP**
130+
131+
```php
132+
class Solution {
133+
/**
134+
* @param String $s
135+
* @return String
136+
*/
137+
function makeFancyString($s) {
138+
$rs = "";
139+
for ($i = 0; $i < strlen($s); $i++) {
140+
if ($s[$i] == $s[$i + 1] && $s[$i] == $s[$i + 2]) continue;
141+
else $rs .= $s[$i];
142+
}
143+
return $rs;
144+
}
145+
}
146+
```
147+
129148
### **...**
130149

131150
```

solution/1900-1999/1957.Delete Characters to Make Fancy String/README_EN.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,25 @@ func makeFancyString(s string) string {
116116
}
117117
```
118118

119+
### **PHP**
120+
121+
```php
122+
class Solution {
123+
/**
124+
* @param String $s
125+
* @return String
126+
*/
127+
function makeFancyString($s) {
128+
$rs = "";
129+
for ($i = 0; $i < strlen($s); $i++) {
130+
if ($s[$i] == $s[$i + 1] && $s[$i] == $s[$i + 2]) continue;
131+
else $rs .= $s[$i];
132+
}
133+
return $rs;
134+
}
135+
}
136+
```
137+
119138
### **...**
120139

121140
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution {
2+
/**
3+
* @param String $s
4+
* @return String
5+
*/
6+
function makeFancyString($s) {
7+
$rs = "";
8+
for ($i = 0; $i < strlen($s); $i++) {
9+
if ($s[$i] == $s[$i + 1] && $s[$i] == $s[$i + 2]) continue;
10+
else $rs .= $s[$i];
11+
}
12+
return $rs;
13+
}
14+
}

0 commit comments

Comments
 (0)