Mars Exploration

  • + 0 comments

    Herw my java code:

    public static int marsExploration(String s) {
     int    count = 0;
    char[] ch = s.toCharArray();
    for(int i=0; i<s.length(); i+=3) {
        if(ch[i] !='S')
            count++;
        if(ch[i+1] !='O')
            count++;
        if(ch[i+2] !='S')
           count++;
    }
    return count;
    }