+ 2
I tried the flowing words challenge but two test cases are getting failed, can anyone tell the problem please.
6 Antworten
+ 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
+ 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.
+ 4
Thanks for the answers, now got my mistake 👍
+ 3
"Flowing words" , details?
Where can i find it...?
+ 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.
+ 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...