MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

Hackerrank_problems/Mars Exploration/solution.cpp:4–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2
3using namespace std;
4int main()
5{
6 string s;//to store the input string
7 getline(cin, s);
8
9int l=s.length( );//length of string
10int k=0;//count of letters changed
11for(int i=0;i<l;i++)
12{
13if((((i+1)%3==1)||((i+1)%3==0)) && (s[i]=='S'))//to store the number of S
14k++;
15if(((i+1)%3==2)&&(s[i]=='O'))//to store the number of O
16k++;
17}
18 cout<<s.length()-k;//the letters which is neither S nor O is our required number
19 return 0;
20}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected