Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering


Write a program to check the overlapping of one string's suffix with the prefix of another string.

Input


The first line of the input will contain a string A.

The second line of the input will contain a string B.

Output


The output should contain overlapping word if present else print "No overlapping".

Explanation


For example, if the given two strings, A and B, are "ramisgood" "goodforall"

The output should be "good" as good overlaps as a suffix of the first string and prefix of next



Given two polynomials A and B, write a program that adds the given two polynomials A and B.



input:

4

0 5

1 0

2 10

3 6

4

0 -5

1 0

2 -10

3 -6


expected output:



your output:


(nothing)




input:

4

0 5

1 0

2 10

3 6

3

0 1

1 2

2 4


output:


6x^3 + 14x^2 + 2x + 6


Errors/Warnings:

Traceback (most recent call last):

 File "main.py", line 69, in <module>

  a = input_polinom()

 File "main.py", line 2, in input_polinom

  n = int(input())

EOFError: EOF when reading a line


expected output:

6x^3 + 14x^2 + 2x + 6




How to convert the string from camel case to snake case using iterate over the words and using string slicing approximately


def max_sub_list(l:list):

if len(l) == 0:

print(0)

else:

max_sum = l[0]

for i in range(len(l)):

for j in range(i, len(l)):

if sum(l[j-i:j+1]) > max_sum:

max_sum = sum(l[j-i:j+1])

print(max_sum)

while True:

try:

arr = list(map(int,input().split()))

except ValueError:

continue

max_sub_list(arr)

Output:6


Traceback (most recent call last):

File "main.py", line 13, in <module>

arr = list(map(int,input().split()))

EOFError: EOF when reading a line

Can anyone give correct code



Summary

Code

DESCRIPTION

DISCUSS

Max Contiguous Subarray

Given a list of integers, write a program to identify the contiguous sub-list that has the largest sum and print the sum. Any non-empty slice of the list with step size 1 can be considered as a contiguous sub-list.

Input


The input will contain space-separated integers, denoting the elements of the list.

Output


The output should be an integer.

Explanation


For example, if the given list is [2, -4, 5, -1, 2, -3], then all the possible contiguous sub-lists will be,

[2]

[2, -4]

[2, -4, 5]

[2, -4, 5, -1]

[2, -4, 5, -1, 2]

[2, -4, 5, -1, 2, -3]

[-4]

[-4, 5]

[-4, 5, -1]

[-4, 5, -1, 2]

[-4, 5, -1, 2, -3]

[5]

[5, -1]

[5, -1, 2]

[5, -1, 2, -3]

[-1]

[-1, 2]

[-1, 2, -3]

[2]

[2, -3]

[-3]

Among the above contiguous sub-lists, the contiguous sub-list [5, -1, 2] has the largest sum which is 6.


Input


The input will be a single line containing two integers and operator(+, -, *, /, and %) similar to 3 + 5.

Output


If the given operator is "+", print the sum of two numbers.

If the given operator is "-", print the result of the subtraction of the two numbers.

If the given operator is "*", print the multiplication of the two numbers.

If the given operator is "/", print the result of the division of the two numbers.

If the given operator is "%", print the result of the modulus operation of the two numbers.




Write a program for given m*n matrix find its anti diagonal matrix


Given a string, write a program to print a secret message that replaces characters with numbers 'a' with 1, 'b' with 2, ..., 'z' with 26 where characters are separated by '-'.


input:

python learning


expected output: 16-25-20-8-15-14 12-5-1-18-14-9-14-7


your output: 16-25-20-8-15-14- 12-5-1-18-14-9-14-7


there is is extra " - " after 14 please rectify it !!!




Given two polynomials A and B, write a program that adds the given two polynomials A and B.



input:

4

0 5

1 0

2 10

3 6

4

0 -5

1 0

2 -10

3 -6


expected output:



your output:


(nothing)



please rectify this issue!!



Ordered Matrix:



Given a M x N matrix, write a program to print the matrix after ordering all the elements of the matrix in increasing order.


input:

3 3

1 20 3

30 10 2

5 11 15



output:

[[1, 2, 3], [5, 10, 11], [15, 20, 30]]


expected output:

1 2 3 
5 10 11 
15 20 30 


input:

2 5

-50 20 3 25 -20

88 17 38 72 -10


expected output:


-50 -20 -10 3 17 
20 25 38 72 88 


please rectify it:



LATEST TUTORIALS
APPROVED BY CLIENTS