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
2 Respuestas
+ 2
$ can be the first or last character
+ 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 😉