public class demo
{
public static void main(String[] args)
{
stringTime("dfdf764gd76gSsddf");
}
static void stringTime(String s)
{
int count = 0;
char[] arr = s.toCharArray();
for (char y='a';y<='z' ;y++ )
{
for (int x=0;x<arr.length ;x++ )
{
if (s.charAt(x)==y)
{
count++;
}
}
if (count>0)
{
System.out.print(y+"("+count+")");
count = 0;
}
}
}
} |