Skip to content

Instantly share code, notes, and snippets.

@fredbr
Created March 12, 2018 21:15
Show Gist options
  • Save fredbr/b158e2aba7608f5532b7e352eb5d2805 to your computer and use it in GitHub Desktop.
Save fredbr/b158e2aba7608f5532b7e352eb5d2805 to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
string s;
cin >> s;
int ald_cen = 0;
int cen_ald = 0;
for (int i = 0; i < n-1; i++) {
if (s[i] == 'A' and s[i+1] == 'C') ald_cen++;
if (s[i] == 'C' and s[i+1] == 'A') cen_ald++;
}
if (ald_cen > cen_ald) cout << "SIM\n";
else cout << "NAO\n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment