Mars Exploration

  • + 0 comments

    C Solution:

    int marsExploration(char* s) {
        int count=0,i=0;
        char SOS[]="SOS";
        while(*s){
            if(i>=3){
                i=0;
            }
            if(SOS[i]!=*s){
                count++;
            }
            i++;
            s++;
        }
        return count;
    }