PLEASE CODE IN C++ Assume that the twenty-six capital letters A to Z represent the coordinates 1 to 26, respectively. Gi

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

PLEASE CODE IN C++ Assume that the twenty-six capital letters A to Z represent the coordinates 1 to 26, respectively. Gi

Post by answerhappygod »

PLEASE CODE IN C++
Assume that the twenty-six capital letters A to Z represent the
coordinates 1 to 26, respectively. Given two English letter strings
that are not necessarily of equal length, the calculation method to
define the distance between them is as follows: first add the
interval symbol: "*" to the shorter string to make it equal in
length, and the coordinate value of the interval symbol is Enter
the value, and then calculate the distance between the two letters
in the same position, that is, subtract the coordinates
corresponding to the two letters and take the absolute value, and
finally add up all the distances.
For example: if the coordinate value of the interval symbol is
30, the distance between AEC and B*D is: |1-2|+|5-30|+|3-4|=27.
Please design a program that can add spaces to shorter strings
Symbol: "*", make two strings of equal length. For example: the
first string is: ADBC, the second string is AC. Then the situation
after adding the space symbol to the second string can be: AC**,
A*C*, *AC*, A**C, *A*C, or **AC, when the coordinate value of the
space symbol is 30 , the distances are 56, 54, 60, 54, 60, 56,
respectively. The output maximum distance is 60 and there are a
total of 2 ways of adding spacer symbols to produce the maximum
distance.
INPUT description:
Each file may have multiple test data, and each test data has
three columns. The first two columns are the input two strings of
uppercase English characters, and the third column is the
coordinate value of the space symbol.
Output description:
After adding space symbols to the output shorter string, the
maximum distance between the two strings can be obtained, and there
are several ways of adding space symbols to generate the maximum
distance.
Example input:
MIN
PK
30
MIN
P
30
Example output:
27 2
40 3
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply