diff --git a/08_String/prb.class b/08_String/prb.class new file mode 100644 index 0000000..2c762dc Binary files /dev/null and b/08_String/prb.class differ diff --git a/08_String/prb.java b/08_String/prb.java new file mode 100644 index 0000000..d375ede --- /dev/null +++ b/08_String/prb.java @@ -0,0 +1,22 @@ +public class prb { + public static String getFre(String str){ + int fre[]= new int[26]; + for(char ch : str.toCharArray()){ + fre[ch-'a']++; + } + + StringBuilder sb = new StringBuilder(""); + char c = 'a'; + for(int i : fre){ + sb.append(c); + sb.append(i); + c++; + } + return sb.toString(); + + } + public static void main(String[] args) { + String strs = "aabbc"; + System.out.println(getFre(strs)); + } +}