Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Remove duplicates in string
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { String s1="lovelylikki"; String s2=""; for(int i=0;i<=s1.length()-1;i++) { char ch=s1.charAt(i); int index=s2.indexOf(ch); if(index==-1) { s2=s2+ch; }} System.out.println(s2); }}
run
|
edit
|
history
|
help
0
float
1a
hw1p1
Bbs
Triangle
motifCatur
3rd
Star
Vowel Substring
Rabbits in forest (leetod)