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


Maximum distance same characers

Hello I have come across this problem 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


6 Answers

New Answer



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


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


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


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.


According to my logic, the following solution should work on all cases you can think of.