0
Solo, what the star is that?
You cannot Use "for (int i=0;i<text.length();i++)" because compiler won't compare i and text.length(). BUT "int length=text.length()" will work in "for (int i=0; i<length;i++)"! I've spent An hour because of this mistake!!! https://code.sololearn.com/cDWasqMUI61X/?ref=app
2 Answers
+ 2
That is because the length() method returns a size_type, which is an unsigned type, and the compiler doesn't "like" comparing integers of different signedness because it can easily be a potential source for mistakes. But usually that should only raise a warning, not an error, so the program should still run.
+ 4
I suggest you to attach your code link within your thread Description. Partial code like that doesn't help much with analysis.
See this if you don't know how to share links đ
https://www.sololearn.com/post/75089/?ref=app