c++, Basic Computer Science

Assignment Help:
Ask question #MiniA string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''''a''''-''''z'''') and the ascii values will starts from 1 (i.e ascii value of ''''a'''' is 1 and ''''z'''' is 26). Now given a string S, you can perform operations, namely, add, delete and replace of any character present in the string. Every operation will consists of following costs

add = 2 unit
replace = 1 unit
delete = 3 unit

Your task is to convert the string to super ascii with the minimum cost. While converting the string to super ascii, the final string should contain the same characters as in the input string.

Input Format:

First line starts with T i.e. number of test cases, and then T lines will follow each containing a string "S".

Output Format:

Print the minimum cost of conversion for each string to a Super Ascii string.

Constraints:
1<=T<=100

1<=|S|<=300, S will contains only lower case alphabets (''''a''''-''''z'''')mum 100 words accepted#

Related Discussions:- c++

C, What is a Structure?

What is a Structure?

History , when was the first computer made

when was the first computer made

Micro-computer, explain the function of each block in the block diagram of ...

explain the function of each block in the block diagram of micro-computer

What is the difference between kernel mode and user mode fun, The differenc...

The difference between kernel mode and user mode gives a rudimentary form of security in the following manner. Convinced instructions could be executed only when the CPU is in kern

Cryptography, Assume |s1|=|s2|=n and consider the functions defined, for an...

Assume |s1|=|s2|=n and consider the functions defined, for any s1 and s2, as: (a) G1(s1,s2)=s1 xor s2, (b) G2(s1,s2)=(s1, s2, s1 xor s2). We have that: A. G1 and G2 are pseudo-ra

Hypertext transfer protocol (http), It's a common protocol or "language" co...

It's a common protocol or "language" computers use to "speak" to each other over the Web.

Describe CPU registers , The CPU has four internal registers, each of 16 bi...

The CPU has four internal registers, each of 16 bits. The first four, AX, BX, CX, and DX are common use registers and can also be used as 8 bit registers, if used in such a way it

Autonomous rational agents - artificial intelligence, A utonomous Rational...

A utonomous Rational Agents: In many cases, it is not accurate to talk about a particular program or a particular  robot, as the combination of and software and hardware in so

Communication networks and local area networks, Communication Networks: ...

Communication Networks: Communication networks are made up of transmission lines, concentrators, switching mechanisms and non-data processing components. Due to increased comp

With an example, Question 1 With an example, illustrate the concept of ext...

Question 1 With an example, illustrate the concept of extern variable Question 2 What is the difference between pointer variable and simple variable? Question 3 Give the

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd