You are on page 1of 2

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package assign;

import java.util.Scanner;

public class Assign {

public static void main(String[] args) {

Scanner scan=new Scanner(System.in);

char ch;

int count;

int i;

String str;

System.out.println("Enter String:");

str=scan.nextLine();

str=str.toLowerCase();

for(ch=0;ch<str.length();ch++)

count=0;

for(i=0;i<str.length();i++)

if(str.charAt(i)==str.charAt(ch))
{

count++;

System.out.println("The Number of Occurences of " +str.charAt(ch)+ " is: "+count);

You might also like