is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
import java.io.*;
- sourav March 03, 2015public class Counts
{
public static void main(String[] args) throws IOException
{
InputStreamReader obj = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(obj);
System.out.println("Enter the string:");
String str = br.readLine();
int size = str.length();
char c[] = new char[size];
str.getChars(0,size,c,0);
//creating an integer array to store the values of the characters of the string array
int b[] = new int[size];
for(int i=0;i<size;i++)
{
int temp = (int)c[i];
b[i]=temp;
}
//now let us sort the array of integers using bubble sort
for(int i=0;i<size;i++)
{
for(int j=0;j+1<size;j++)
{
if(b[j+1]<b[j])
{
//do swapping
b[j] = b[j] + b[j+1];
b[j+1] = b[j] - b[j+1];
b[j] = b[j]-b[j+1];
}
}
}
//now take the contents of the values of the integer array and store them in the char array
System.out.println("Array after sorting");
for(int i=0;i<size;i++)
{
char cc = (char)b[i];
c[i]=cc;
System.out.println(c[i]);
}
//now let us count the frequency of each of the characters
System.out.println("--------------------------");
int length=0,m=0;
for(int i=0;i<size;i++)
{
char key = c[m];
System.out.print(key);
for(int j=m;j<size;j++)
{
if(c[j]==key)
{
length++;
}
else
{
break;
}
}
if(length==1)
{
System.out.print("");
}
else
{
System.out.print(length);
}
m += length;
length=0;
if(m==size)
break;
}
}
}