Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
0% Quality Score
Upvotes Received
0
Posts with Upvotes
0
Upvoting Members
0
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
0 Endorsements
Ranked #107.55K
~483 People Reached
Favorite Forums
Favorite Tags
java x 1

1 Posted Topic

Member Avatar for hbelle.28

try This and good lack: public static void main(String[] args) { String returnedString=""; StringBuffer st= new StringBuffer("aannjn"); int pos=0; int times=0; String str=st.toString(); while(st.length()>0){ char ch=st.charAt(0); times=0; int max=str.length(); while((pos=str.indexOf(ch))!=-1 ){ times++; st.deleteCharAt(pos); str=st.toString(); } returnedString+=ch +":"+ times+"\n"; } System.out.println(returnedString);// } } // imputs: a:2 n:3 j:1

Member Avatar for stultuske
0
483

The End.