Skip to content

Commit ab17bef

Browse files
Create ASS(7)6.cpp
1 parent 41ba117 commit ab17bef

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

ASS(7)6.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <iostream>
2+
using namespace std;
3+
void remDup(char* S)
4+
{
5+
/// empty
6+
if (S[0] == '\0')
7+
return;
8+
9+
10+
if (S[0] == S[1]) {
11+
int i = 0;
12+
while (S[i] != '\0') {
13+
S[i] = S[i + 1];
14+
i++;
15+
}
16+
remDup(S);
17+
}
18+
remDup(S + 1);
19+
}
20+
21+
int main()
22+
{
23+
char S2[] = "hello";
24+
remDup(S2);
25+
cout << S2 << endl;
26+
27+
return 0;
28+
}

0 commit comments

Comments
 (0)