Skip to content

Commit 3ef682d

Browse files
authored
Create 1957_delete_characters_to_make_fancy_strings.cpp
1 parent cb6a0d3 commit 3ef682d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Solution {
2+
public:
3+
string makeFancyString(string s) {
4+
int l=0;
5+
string res="";
6+
7+
while(l<s.size()){
8+
if(res.size()>=2 && res[res.size()-1]== s[l] && res[res.size()-2]==s[l]){
9+
l++;
10+
continue;
11+
}
12+
else{
13+
res+=s[l];
14+
l++;
15+
}
16+
}
17+
return res;
18+
}
19+
};

0 commit comments

Comments
 (0)