index

index

View Answers

August 10, 2009 at 4:40 PM

Hi Friend,

Try the following code:

import java.io.*;
import java.awt.*;
import java.util.*;
import javax.swing.*;

class CountCharacters {
public static void main(String[] args) throws Exception{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Please enter string ");
System.out.println();
String str=br.readLine();
String st=str.replaceAll(" ", "");

char[]third =st.toCharArray();
for(int counter =0;counter<third.length;counter++){
char ch= third[counter];
int count=0;
for ( int i=0; i<third.length; i++){
if (ch==third[i])
count++;
}
boolean flag=false;
for(int j=counter-1;j>=0;j--){
if(ch==third[j])
flag=true;
}
if(!flag){
System.out.println("Character :"+ch+" occurs "+count+" times ");
}
}
}
}

Hope that it will be helpful for you.
Thanks









Related Tutorials/Questions & Answers:
What is Index?
What is Index?  What is Index
index of javaprogram
index of javaprogram  what is the step of learning java. i am not asking syllabus am i am asking the step of program to teach a pesonal student.   To learn java, please visit the following link: Java Tutorial
Advertisements
index
rename index in elasticsearch
rename index in elasticsearch  How to rename index in elasticsearch? I have an index with millions of records in it. I want to rename this index... is the command to rename index in elasticsearch? I am using Elasticsearch 6.1. Thanks
Drop Index
Drop Index       Drop Index is used to remove one or more indexes from the current database... Index. In this example, we create a table Stu_Table. The create table is used
clustered and a non-clustered index?
clustered and a non-clustered index?  What is the difference between clustered and a non-clustered index
ModuleNotFoundError: No module named 'index'
ModuleNotFoundError: No module named 'index'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'index' How to remove the ModuleNotFoundError: No module named 'index'
ModuleNotFoundError: No module named 'index'
ModuleNotFoundError: No module named 'index'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'index' How to remove the ModuleNotFoundError: No module named 'index'
ModuleNotFoundError: No module named 'index-by'
ModuleNotFoundError: No module named 'index-by'  Hi, My Python... 'index-by' How to remove the ModuleNotFoundError: No module named 'index... to install padas library. You can install index-by python with following
Mysql Btree Index
Mysql Btree Index  Mysql BTree Index Which tree is implemented to btree index? (Binary tree or Bplus tree or Bminus tree
z-index always on top
z-index always on top  Hi, How to make my div always on top using the z-index property? Thanks   Hi, You can use the following code: .mydiv { z-index:9999; } Thanks
array, index, string
array, index, string  how can i make dictionary using array...please help
Version of com.thesett>index dependency
List of Version of com.thesett>index dependency
NSMutableArray change object at Index
NSMutableArray change object at Index   NSMutableArray change object at Index   // Browse all messages (you can use "for (NSDictionary *message in allMessageArray)" enumerate loop but because we need the index
$_GET[] index is not defined
$_GET[] index is not defined  Hi, What could be solution of the error: $_GET['someparameter'] index is not defined Thanks   Hi, You can use the following code: if (isset($_GET['someparameter'])) { // your code
checking index in prepared statement
checking index in prepared statement  If we write as follows: String query = "insert into st_details values(?,?,?)"; PreparedStatement ps = con.prepareStatement(query); then after query has been prepared, can we check the index
alter table create index mysql
alter table create index mysql  Hi, What is the query for altering table and adding index on a table field? Thanks
JavaScript array index of
JavaScript array index of  In this Tutorial we want to describe that makes you to easy to understand JavaScript array index of. We are using JavaScript... line. 1)index of( )  - This return the position of the value that is hold
alter table create index mysql
alter table create index mysql  Hi, What is the query for altering table and adding index on a table field? Thanks   Hi, Query is: ALTER TABLE account ADD INDEX (accounttype); Thanks
ModuleNotFoundError: No module named 'carbon-index'
ModuleNotFoundError: No module named 'carbon-index'  Hi, My Python... 'carbon-index' How to remove the ModuleNotFoundError: No module named 'carbon-index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cobs-index'
ModuleNotFoundError: No module named 'cobs-index'  Hi, My Python... 'cobs-index' How to remove the ModuleNotFoundError: No module named 'cobs-index' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'eth-index'
ModuleNotFoundError: No module named 'eth-index'  Hi, My Python... 'eth-index' How to remove the ModuleNotFoundError: No module named 'eth-index' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'jaccard-index'
ModuleNotFoundError: No module named 'jaccard-index'  Hi, My... 'jaccard-index' How to remove the ModuleNotFoundError: No module named 'jaccard-index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'lazo-index'
ModuleNotFoundError: No module named 'lazo-index'  Hi, My Python... 'lazo-index' How to remove the ModuleNotFoundError: No module named 'lazo-index' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'omega_index'
ModuleNotFoundError: No module named 'omega_index'  Hi, My Python... 'omega_index' How to remove the ModuleNotFoundError: No module named 'omega_index' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'package-index'
ModuleNotFoundError: No module named 'package-index'  Hi, My... 'package-index' How to remove the ModuleNotFoundError: No module named 'package-index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ref_index'
ModuleNotFoundError: No module named 'ref_index'  Hi, My Python... 'ref_index' How to remove the ModuleNotFoundError: No module named 'ref_index' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'stylelens-index'
ModuleNotFoundError: No module named 'stylelens-index'  Hi, My... named 'stylelens-index' How to remove the ModuleNotFoundError: No module named 'stylelens-index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'tpu-index'
ModuleNotFoundError: No module named 'tpu-index'  Hi, My Python... 'tpu-index' How to remove the ModuleNotFoundError: No module named 'tpu-index' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'aiohttp-index'
ModuleNotFoundError: No module named 'aiohttp-index'  Hi, My... 'aiohttp-index' How to remove the ModuleNotFoundError: No module named 'aiohttp-index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'carbon-index'
ModuleNotFoundError: No module named 'carbon-index'  Hi, My Python... 'carbon-index' How to remove the ModuleNotFoundError: No module named 'carbon-index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cobs-index'
ModuleNotFoundError: No module named 'cobs-index'  Hi, My Python... 'cobs-index' How to remove the ModuleNotFoundError: No module named 'cobs-index' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'digit-index'
ModuleNotFoundError: No module named 'digit-index'  Hi, My Python... 'digit-index' How to remove the ModuleNotFoundError: No module named 'digit-index' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'dropbox-index'
ModuleNotFoundError: No module named 'dropbox-index'  Hi, My... 'dropbox-index' How to remove the ModuleNotFoundError: No module named 'dropbox-index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'eth-index'
ModuleNotFoundError: No module named 'eth-index'  Hi, My Python... 'eth-index' How to remove the ModuleNotFoundError: No module named 'eth-index' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'flatpages_index'
ModuleNotFoundError: No module named 'flatpages_index'  Hi, My... named 'flatpages_index' How to remove the ModuleNotFoundError: No module named 'flatpages_index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'gamma_index'
ModuleNotFoundError: No module named 'gamma_index'  Hi, My Python... 'gamma_index' How to remove the ModuleNotFoundError: No module named 'gamma_index' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'index-analysis'
ModuleNotFoundError: No module named 'index-analysis'  Hi, My... named 'index-analysis' How to remove the ModuleNotFoundError: No module named 'index-analysis' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'index_flask'
ModuleNotFoundError: No module named 'index_flask'  Hi, My Python... 'index_flask' How to remove the ModuleNotFoundError: No module named 'index_flask' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'INDEX-jpc'
ModuleNotFoundError: No module named 'INDEX-jpc'  Hi, My Python... 'INDEX-jpc' How to remove the ModuleNotFoundError: No module named 'INDEX... have to install padas library. You can install INDEX-jpc python with following
ModuleNotFoundError: No module named 'jaccard-index'
ModuleNotFoundError: No module named 'jaccard-index'  Hi, My... 'jaccard-index' How to remove the ModuleNotFoundError: No module named 'jaccard-index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dropbox-index'
ModuleNotFoundError: No module named 'dropbox-index'  Hi, My... 'dropbox-index' How to remove the ModuleNotFoundError: No module named 'dropbox-index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'jaccard-index'
ModuleNotFoundError: No module named 'jaccard-index'  Hi, My... 'jaccard-index' How to remove the ModuleNotFoundError: No module named 'jaccard-index' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'redis-index'
ModuleNotFoundError: No module named 'redis-index'  Hi, My Python... 'redis-index' How to remove the ModuleNotFoundError: No module named 'redis-index' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'index-generator'
ModuleNotFoundError: No module named 'index-generator'  Hi, My... named 'index-generator' How to remove the ModuleNotFoundError: No module named 'index-generator' error? Thanks   Hi, In your python
Drop Index
Drop Index       Drop Index is used to remove one or more indexes from the current database... an example from Drop Index. In this example, we create a table Stu_Table. The create
Java arraylist index() Function
Java arrayList has index for each added element. This index starts from 0. arrayList values can be retrieved by the get(index) method. Example of Java Arraylist Index() Function import
creating index for xml files - XML
creating index for xml files  I would like to create an index file... after another and then retrieve each tag and create index to that file. In some cases, more than one file may have same name. So, my index file would be like
Maven Dependency index >> 0.9.65
You should include the dependency code given in this page to add Maven Dependency of com.thesett >> index version0.9.65 in your project
Maven Dependency index >> 0.8.1
You should include the dependency code given in this page to add Maven Dependency of com.thesett >> index version0.8.1 in your project

Ads