answersLogoWhite

0

In Java

// the string we want to process

final String str = "Mumbai";

// convenience conversion to characters

final char[] str_chars = str.toCharArray();

// letters used to keep track of which characters we've counted

final Set letters = new HashSet();

// iterate through each character in str

for (int i = 0; i < str_chars.length; ++i) {

// store lower case version of ch so we only need to convert once

final char ch_l = Character.toLowerCase(str_chars[i]);

// only process this letter if we haven't done so yet

if (!letters.contains(ch_l)) {

// store letter

letters.add(ch_l);

// count number of times this letter is in str

int count = 1;

for (int j = i + 1; j < str_chars.length; ++j) {

if (ch_l == Character.toLowerCase(str_chars[j])) {

++count;

}

}

// output

System.out.format("%c%d", str_chars[i], count);

}

}

User Avatar

Wiki User

16y ago

What else can I help you with?

Continue Learning about Engineering

Does the computer programm spark have semantics?

All programming languages have semantics. The semantics of a language are the rules of a language; it defines the meaning of symbols and tokens in the language, and how they interact with each other. Spark is certainly no exception to the rule.


Banking operations in c programm?

here is c code for banking system.... #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;conio.h&gt; #include &lt;dos.h&gt; #include&lt;string.h&gt; #include &lt;graphics.h&gt; #define LEN 100 /*====================================================================*/


Explain the differences between C Language and C plus plus Language?

i want a c programme....if i have a collection of alphabhate appox 2000 or more...alphabates r repeted... i want to write a prograam such that first 7 terms r wrriten in first line then next 7 alphabets r writen in next line.. not fully clear ?? i would give u an example: TTCATCATTCCTAATATTTTTCTTGTAGTTGTTTTAAAAAAGGAATTAAC ATCCAATATTCTGTATTACATACTGTACACCAGATTTTGATTTCAGAAAA CAATATTTGATGTATAACTTCCACTTAATTTAAATTTAATAAACTTTTAT TTCAGAGATATTTGATTAGTTTACAATCTAAGAGTTATTCTTAAGAGTTT CAGTGGAATTTTCTTAATTTTTCTAAAGATATTCCTACTCTCTTGATCAT ATTCTAAGTACATATGAGTACATGTACATTCTTATACAATGTCTAAATGG GTTAGAAAATTATTATACCTATAGAAGCGAAACTTGGAAATTAATAGAAT CACTTAAACCAAAATCTTTATAAGACACAATTCTATTGATTTTAAAGCTT CTGCTTTCCAGGCTCTGTTTTCCAGAGTTTATAATTACGTAGTTTTTAGT AGATGAAAATAATGGATTCTTGTACCTAACATTTTATCCTCTTAGATCTA AGAGCCGAAGCTATAGAACTTTGTTAGACTATTTGGCAAGCAAAATATAT GACAGTAAATATCAGAATTTTATGGTTTGACCAGCGCTTATCACATTCCC AATTCAGTGAGAAAAATTCATCTGGGACACAACAGGGTACTCTTCTCTGT TTGCCCAGAATCAGCTCTGGATTTTAAGCCCAGACTTCAGTGGACCCAGA TAGAAAATATAAAGTCTCTGATCTATAGGCCACATCAGGATGTTATTTTA TGAAGAGTTCTAGAGCAAGGTTGCGGAAATCGGGGTGGAGATGGGGAGCA GTGACTCCTCCAAATATTCATTGCTAACAGGCCATTCTATGCAGTTTGTT TTAACAAATCCTGGGTTAAACTGAGGCCACAGGACATGATGGGCTGTTCT ATAAAGCATTCTAAGTGGAGAGGAGACGATAGGGCATATGAAATTCACTA AACTCTCTGGAAAAAAAATATGTATATATTAAAAACCAAGACTGGAATCA GTGCAACAGTGGGAACTACCTTTTACAAGTATCCATTGCTTCATAAACTC CATTTGTTTGGACCAATCCCTTAAACAAAAGCAAGGCAAATTTTACATGG ATTTAGAGCCTAGGTCAGGTTATTAGGATTATAAATTTTCCACTGGTATG TCATTGTGATTATCTTTGTTTTTGTCTTTCTGAAAGATTGGATTTTCTAT AACACCTTGTGTAAGAAAATAAAAAACTTGATCTAACTGAA suppose this is a sequence... i want to write first 7 alphabets in first line...(1st to seventh) TTCATCA next 7 in next line...(2nd to ...8th) TCATCAT next 7(3rd to 9th)....and so on.... can u help me to write this programm.... if u write this programm u get a treat from me....


What is stray pointer?

stray pointer is a that pointer which pin points nothing or anywhere but we dont know... for example: int *ptr; ptr=new int[10]; //this memory is on heap. and at the end of the programm if we dont delete this memory mean to say if we dont deallocate this memory then this type of pointer is pointing towards nothing or anywhere because when we work on heap deletion of pointer is must if we dont delete pointers than they pin point stray or anywhere so that sort of pointer is stray pointer. i think you understand...


Write a programm for addition of two numbers in C plus plus language?

Addition is an intrinsic operator that applies to all primitive data types, both signed and unsigned. There is no need to program it. The operands can be literal, constant or variable, hard-wired or generated from user-input, it makes no difference whatsoever. #include&lt;iostream&gt; int main() { std::cout&lt;&lt;"The sum of 1 and 2 is "&lt;&lt;(1+2)&lt;&lt;std::endl; std::cout&lt;&lt;"The sum of 1.5 and 2.3 is "&lt;&lt;(1.5, 2.3)&lt;&lt;std::endl; return(0); }

Trending Questions
What should be done after a stress cone is installed on a high voltage conductor termination? What are 3 types of opposition to current flow that impedance represents? Should you pour a concrete sidewalk without crushed stone? Can any one of you please suggest which materials are to be prepared for basic mechanical engineering? What are the common errors in shell scripting associated with for loop? What are the various turning operations that can be performed and the shapes and types of tooling that can be used (such as solid speed tooling? What is the difference between P and BR tag? How much voltage does a battery produce? How do you change font size default in tvs msp 250 star printer? Who is the real frank barnes engineer? When a multi dimensional array is passed to a function how are formal argument declaration written? Name different ways of joining metals? How can you tell if a pipe fitting is cast or ductile iron? What can be used to reduce the amount of voltage drop across the branches of a parallel circuit to be less than source voltage? Some technologies like vertical farming have a number of negative effects Which is a negative outcome of this technology? Why won't lotro load? What is meant by open circuit voltage and arc voltage? What is the importance of water supply system? What are the effect of over tightening the compression fitting? If resistor X has the same length and is made of the same material as resistor Y but has twice the diameter. Resistor X has the blank resistance of resistor Y?