57512023-09-16 12:32:48AblablablaBimmbamm (30)cpp17Elfogadva 30/303ms3744 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;

    for(int i = 1; i <= n; i++){
        string a;
        cin >> a;

        if(i % 3 == 0 && i % 5 == 0){
            if(a != "BUMM"){
                cout << i << "\n";
                return 0;
            }
        } else if(i % 5 == 0){
            if(a != "BAMM"){
                cout << i << "\n";
                return 0;
            }
        } else if(i % 3 == 0){
            if(a != "BIMM"){
                cout << i << "\n";
                return 0;
            }
        } else{
            if(a != "SZAM"){
                cout << i << "\n";
                return 0;
            }
        }
    }
}