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 23:00
What computer network component allows data transfers from one computer to another through a telephone line?
Answers: 1
question
Computers and Technology, 22.06.2019 05:30
The total revenues for a company are $150,223 and the total expenses were 125,766. if you are calculating the net income, which of these spreadsheets would you use? insert a spreadsheet with $150,223 in cell b2 and 125, 766 in cell b3. enter a formula =b2-b3. the formula should be showing in the formula bar. insert a spreadsheet with $150,223 in cell b2 and 125, 766 in cell b3. enter a formula =b2+b3. the formula should be showing in the formula bar. insert a spreadsheet with $150,223 in cell b2 and 125, 766 in cell b3. enter a formula =b2/b3. the formula should be showing in the formula bar. insert a spreadsheet with $150,223 in cell b2 and 125, 766 in cell b3. enter a formula =b2*b3. the formula should be showing in the formula bar.
Answers: 3
question
Computers and Technology, 22.06.2019 07:00
Our primary purpouse as electricians is to do wich of the following core concepts? a: install electrical components in a way they can be upgraded b: install electrical equiptment in a way that reduces heat c: install electrical systems in a safe manner d: only b and c
Answers: 1
question
Computers and Technology, 22.06.2019 12:10
1. declare a constant named cents_per_pound and initialize with 25. 2. get the shipping weight from user input storing the weight into shipweightpounds. 3. using flat_fee_cents and cents_per_pound constants, assign shipcostcents with the cost of shipping a package weighing shipweightpounds.
Answers: 2
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
Biology, 12.11.2020 18:50
question
Mathematics, 12.11.2020 18:50
question
History, 12.11.2020 18:50
question
Arts, 12.11.2020 18:50
question
Mathematics, 12.11.2020 18:50
question
History, 12.11.2020 18:50
question
English, 12.11.2020 18:50
question
Arts, 12.11.2020 18:50
question
Mathematics, 12.11.2020 18:50
question
History, 12.11.2020 18:50
Questions on the website: 13722367