Security problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Security problem

my code fails in some test cases. can you help me understand where am I wrong? https://code.sololearn.com/cyXR5GVIoQ58/?ref=app

20th Mar 2022, 9:17 PM
Francesco Famosi
Francesco Famosi - avatar
2 Answers
+ 2
$ can be the first or last character
20th Mar 2022, 10:01 PM
Julia Shabanova
Julia Shabanova - avatar
+ 1
Use variable type "i" size_t instead of int since you are comparing two different value types: for(size_t i=0; i<piano_temp.length(); i++) Better yet, use an improved "for" loop: for(char a: piano_temp) if(a=='G'||a=='
#x27;||a=='T')piano+=a; There are only two cases where an alarm should sound: T$ and $T 😉
20th Mar 2022, 10:32 PM
Solo
Solo - avatar