Computer Science, asked by rairakshanda2211, 8 months ago

Mr. Wick has a faulty keyboard. Some of the keys of the keyboard don't work. So he has copied all those characters corresponding to the faulty keys on a clipboard. Whenever those characters need to be typed he pastes it from the clipboard. In typing whatever is required he needs to make use of paste, backspace and cursor traversal operations. Help him in minimize the number of operations he needs to do to complete his typing assignment. Each operation has one unit weightage

Answers

Answered by mannatssingh9a5hhps2
0

Answer:

Some of the keys of the keyboard don't work. So he has copied all those characters corresponding...characters need to be typed the pastes it from the clipboard.

Hope it's helpful to u

Answered by Saadsiddi
0

Answer:

p=input("")

q=input("")

p1=list(p.split(" "))

q1=list(q.split(" "))

for t in range(0,len(q1)-1):

 c=[0 for i in range(t,len(q1))]

    for i in p1:

     for j in range(len(q1)):

       k1=0

         while(k1):

           m2=c.index(m1)

             for i in range(m2,len(c)):

               if(c[i]==m1):

                 if(ord(q1[i])<ord(q1[m2])):

                     m2=i

                 else:

                     m2=c.index(m1)

                     q1[m2],q1[t]=q1[t],q1[m2]

print("".join(q1))

Explanation:

Using nested loop, we compare the list t and s, and add number of operations according to the question.

Similar questions