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

Function main

CodeChef_problems/XYSTR/Solution.cpp:9–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7using namespace std;
8
9int main()
10{
11 int testCases;
12 cin >> testCases;
13 while (testCases--)
14 {
15 string s;
16 cin >> s;
17 int ans = 0;
18 for (int i = 0; i < s.size() - 1; ++i)
19 {
20 if ((s[i] == 'x' and s[i + 1] == 'y') or (s[i] == 'y' and s[i + 1] == 'x'))
21 {
22 ans++;
23 i++;
24 }
25 }
26 cout << ans << '\n';
27 }
28
29 return 0;
30}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected