Maximum distance same characers | Sololearn: Learn to code for FREE!

+2

Maximum distance same characers

Hello I have come across this problem https://code.sololearn.com/cnQb8j2tO05k/?ref=app for this problem there are 15 private hidden testcases are there for my code only 13 testcases are passed 2 testcases failed could you please tell me what could be the private testcases.

10/24/2020 3:18:50 PM

Varshith

6 Answers

New Answer

+5

https://code.sololearn.com/cA5rxlOeB9Jw/?ref=app

0

Hello QTWizard Could you explain which test case might be failed for my code.

0

Voleti Varshith Well, i think you need to check if there any type of repeated punctuations like: ,Hellomadam, This will return ,11 i don't understand what your formula abs(...) trying to compute. Anyway, your code works fine, but i think you need to eliminate any type of punctuations. I have updated my code to print only the longest distance between alphabetical chars. so the previous case will return m4 and not ,11

0

Actually it was asked in a test.The test was completed so I just want to know which test cases failed for my code.

0

The code inside the abs function finds the last occurring letter in a string and subtracts the first occurring element .This could be write without using abs function also.

-1

According to my logic, the following solution should work on all cases you can think of. https://code.sololearn.com/ctdQ0gTSv8jO/?ref=app