Question: Write a Java program to find the number of repetition of each alphabet in a given string by user.
My Answer:
import java.util.*;
import java.util.Scanner;
// Compiler version JDK 11.0.2
class Dcoder
{
public static void findDuplicateAlphabet(String s){
System.out.println("The following is the count of every alphabets's occurrence in: "+s+".");
int size = s.length();
int count = 0;
for(int i=0; i
for(int j=0; j
if(s.charAt(i)==s.charAt(j)){
count++;
}
}
System.out.println(s.charAt(i)+":"+count);
count=0;
}
}
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
System.out.println("Enter a string: ");
String s = input.nextLine();
s=s.toLowerCase();
findDuplicateAlphabet(s);
}
}
How Many Marks Out Of 20 Can I Get?
Thank You For Your Time.
Answers
Answered by
0
Answer:
you can get 19 out of 20
Explanation:
because your handwriting isnt good in computer.
it should be unique
Similar questions