Skip to content

Commit 9d54756

Browse files
committed
String Solution to Problem Added
1 parent 8919c9e commit 9d54756

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
File renamed without changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import java.util.*;
2+
public class Main
3+
{
4+
public static void main(String[] args) {
5+
Scanner sc = new Scanner(System.in);
6+
String s = "aadddgghhhha";
7+
char ch[] = s.toCharArray();
8+
String str = "";
9+
for (int i = 0; i < ch.length - 1; i++) {
10+
if (ch[i] != ch[i + 1]) {
11+
str += ch[i];
12+
}
13+
}
14+
str += ch[ch.length - 1];
15+
System.out.println(str);
16+
}
17+
}

0 commit comments

Comments
 (0)