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, 22.06.2019 20:00
Which location-sharing service offers items for users as a gaming component and also allows them to collectively link their check-ins to publish a trip? a. whrrl b. buzzd c. foursquare (this option is wrong i already tried) d. gowalla for plato
Answers: 2
question
Computers and Technology, 24.06.2019 21:30
Aobject is used for displaying the results of a question based on stored data. a. query b. report c. table d. form
Answers: 2
question
Computers and Technology, 25.06.2019 08:00
Ais the hardware where the data is actually stored.
Answers: 1
question
Computers and Technology, 25.06.2019 18:30
Which type of navigation involves multiple frames that are linked to a number of other frames? a) bread crumbs b) linear c) reciprocal d) web which type of navigation is similar to a book because users can move back and forth between frames? a) hierarchical b) linear c) reciprocal d) sequential how many items should a menu system have? a) 1-3 b) 5-8 c) 9-11 d) 13-18
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, 19.03.2021 21:40
question
Mathematics, 19.03.2021 21:40
question
English, 19.03.2021 21:40
question
Mathematics, 19.03.2021 21:40
Questions on the website: 13722363