I tried the flowing words challenge but two test cases are getting failed, can anyone tell the problem please. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I tried the flowing words challenge but two test cases are getting failed, can anyone tell the problem please.

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

30th Aug 2023, 11:17 AM
Pramesh
6 Answers
+ 5
Hint: The task said that you have to check a whole sequence and the output with one result only should be true or false depending if all are flowing words or not. And this is a example for one test: Sample Input: this string gets stuck Sample Output: true
30th Aug 2023, 3:40 PM
JaScript
JaScript - avatar
+ 5
the task description is not quite complete, so this is for information: what is a flowing word: if the first letter of each word is the same as the last letter of the previous word.
30th Aug 2023, 6:27 PM
Lothar
Lothar - avatar
+ 4
Thanks for the answers, now got my mistake 👍
31st Aug 2023, 5:13 PM
Pramesh
+ 3
"Flowing words" , details? Where can i find it...?
30th Aug 2023, 12:12 PM
Jayakrishna 🇮🇳
+ 3
i solved it yesterday with python, but i dont know java. “dont take it away” that string should be false but your code says true, because not all are true.
30th Aug 2023, 2:50 PM
Angela
Angela - avatar
+ 3
Thanks for info mates... Pramesh your code works fine for only 2 word input. You are using break in if which causes to terminate loop after first space encounter with equal characters. And there is no relevant code in second if block as per description. No need to convert to uppercase and == operator check the references for string, not the content value. You need to use equals() or equalsIgnoreCase() methods for string comparisions. For the task, repeat first if till end of string without using break. For sample: "this string gets stuck" You need to check 's' == 's' & 'g' == 'g' & 's' == 's' then print true For sample : "dont take it away" 't'=='t' & 'e' == 'i' false then no need to continue check. Print false and exit loop. Hope it helps to clear it...
31st Aug 2023, 2:32 PM
Jayakrishna 🇮🇳