Wrong answer for " H Kv Scy GX eUKm FwiY RGjNRDz ZXYNVdNSfKjf nMX "


#1

This input is giving correct result when running as a custom testcase but not working, when I am trying to submit. Please HELP…
int i=0; while(A[i]==' ') i++; string ret = A.substr(i); for(int i=A.size()-1;i>=0;i--){ if(ret[i]==' '){ ret.pop_back(); }else break; } int last_index=-1; for(int i=0;i<ret.size();i++){ if(ret[i]==' ') last_index=i; } string tmp=""; for(int i=last_index+1;i<ret.size();i++){ if(ret[i]==' ') break; tmp.push_back(ret[i]); } return tmp.size();