Hello, can anybody advise what Iam doing wrong?
Challenge: Find the highest word in string. Letter a=1, b=2, c=3... It reports me error but I do not know what is wrong. The same error happens in some of my programs. https://code.sololearn.com/cW4uyck57029/?ref=app
8/7/2022 3:08:30 PMTeaserCode
8 AnswersNew Answer
Yes. Am not tested it fully.. But i may cause.. You can eliminate using of that array actually.. Use directly sum[i5] += value[i12++] ; Comment array declaration and use.. Try then..
Where you testing this? That's may be because of your ide..! Error in path settings..! here : int value1[count+1][arr[i12].length()]; if arr is not bigger word then you may go to access array value1 beyond its length...
What is final compiler? What is your output? Am getting "taxi" but it's same if even if some other words have more length next... Did you try with different words? I think above array declaration may cause error .. Make sure array has enough length...
I solve it, problem was in finding max element in sum array.
I try it on several online compiler and sololearn. And they print correct result. But when I try it on final compiler (whose challenge is) it report error. The point is not the longest word but highest sum of letters of every word if you convert them to succession numbers. Sorry can you be more precise.
Final compiler is compiler where I get this exercise. The way I chose is by convering original string into string array. I will add additional tests to test. So you ll see that all go correct.
Interesting: Test with first word is bigger..!!
Is it what you said at the beginning? Do you have any idea, how to solve it. I don't have it. It must be scope.