subject

Task 3 Python Files A string S consisting of the letters A, B, C and D is given. The string can be transformed either by removing a letter A together with an adjacent letter B, or by removing a letter c together with an adjacent letter D. Write a function: task3 solution. py test-input. txt solution. py x 1 W you can write to 2 # print("this is a 3 4- def solution(S): 5 # write your c 6 pass 7 def solution (S) = that, given a string S consisting of N characters, returns any string that: • can be obtained from S by repeatedly applying the described transformation, and • cannot be further transformed. If at some point there is more than one possible way to transform the string, any of the valid transformations may be chosen. Examples: 1. Given S = "CBACD", the function may return "C", because one of the possible sequences of operations is as follows: CBACD СВА с Test Output 2. Given S = "CABABD" the function may return an empty string, because one possible sequence of operations is: CABABD CABD CD 3. Given string S = "ACBDACBD" the function should return "ACBDACBD", because no operation can be applied to string S. 3. Given string S = "ACBDACBD" the function should return "ACBDACBD", because no operation can be applied to string S. Write an efficient algorithm for the following assumptions: • the length of S is within the range [0...250,000); • string S consists only of the following characters: "A", "B", "C" and/or "D".

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
What is the most important aspect of marking media? a. data labelingb. content descriptionc. electronic labelingd. classification
Answers: 2
question
Computers and Technology, 23.06.2019 03:30
Many everyday occurrences can be represented as a binary bit. for example, a door is open or closed, the stove is on or off, and the fog is asleep or awake. could relationships be represented as a binary value? give example.
Answers: 1
question
Computers and Technology, 23.06.2019 17:30
What are the most commonly found items in the trash according to the municipal solid waste report?
Answers: 1
question
Computers and Technology, 24.06.2019 18:30
What are the benefits to using presentations to organize and deliver information in the workplace? they add visual appeal. they are easy to update. they ensure accuracy. they can be created quickly. the work can't be lost.
Answers: 1
You know the right answer?
Task 3 Python Files A string S consisting of the letters A, B, C and D is given. The string can be t...
Questions
question
Mathematics, 28.05.2020 04:57
question
Mathematics, 28.05.2020 04:57
question
SAT, 28.05.2020 04:57
Questions on the website: 13722367