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, 23.06.2019 02:30
These factors limit the ability to attach files to e-mail messages. location of sender recipient's ability to open file size of file type of operating system used
Answers: 2
question
Computers and Technology, 23.06.2019 02:50
Define a class named movie. include private fields for the title,year, and name of the director. include three public functions withprototypes void movie: : settitle(cstring); , voidmovie: : setyear(int); , void movie: : setdirector(string); . includeanother function that displays all the information about a movie.write a main() function that declares a movie object namedmyfavoritemovie. set and display the object's fields.this is what i have but know its wrong since it will notcompile: #include#includeusing namespace std; //class declarationclass movie{private: string movietitle ; string movieyear; string directorname; public: void settitle(string title); void setyear(string year); void setdirector(string director); void displayinfo(); }; //class implementationvoid movie: : settitle(string title){ movietitle = title; cout< < "what is the title of themovie? "< > temp; myfavoritemovie.settitle(temp); cout< < "enter movie year"< > temp; myfavoritemovie.setyear(temp); cout< < "enter director'sname"< > temp; myfavoritemovie.setdirector(temp); //display all the data myfavoritemovie.displayinfo(); system("pause"); return 0; this code is not entirely mine someone on cramster edited my firstcode but then i try manipulating the new code and i still get acompile error message : \documents\visual studio 2008\projects\movie\movie\movie.cpp(46) : error c2679: binary '< < ' : no operator found which takes aright-hand operand of type 'std: : string' (or there is no acceptableconversion)c: \program files (x86)\microsoft visual studio9.0\vc\include\ostream(653): could be'std: : basic_ostream< _elem,_traits> & std: : operator< < > (std: : basic_ostream< _elem,_traits> & ,const char *)w
Answers: 1
question
Computers and Technology, 23.06.2019 23:00
Lucas put a lot of thought into the design for his company's new white paper. he made sure to include repeating design elements such as color schemes and decorative images. his goal was to a.add symmetry b.create a unified publication c.provide consistency d.save money
Answers: 1
question
Computers and Technology, 24.06.2019 02:20
Peter is thinking of a number which isless than 50. the number has 9 factors.when he adds 4 to the number, itbecomes a multiple of 5. what is thenumber he is thinking of ?
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
Questions on the website: 13722360