Skip to content

Instantly share code, notes, and snippets.

@Hacv16
Created August 16, 2023 20:53
Show Gist options
  • Save Hacv16/082af5abcf64e7eb4303cb01ea16c08c to your computer and use it in GitHub Desktop.
Save Hacv16/082af5abcf64e7eb4303cb01ea16c08c to your computer and use it in GitHub Desktop.
OBI 2023 - Segunda Fase - P1
#include <bits/stdc++.h>
using namespace std;
int n, m;
string s, t;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> s >> m >> t;
int resp = 0;
// Checo os pares de caracteres em posicoes correspondentes
for(int i = 0; i < min(n, m); i++){
if(s[i] == t[i]) resp++;
else break;
}
cout << resp << '\n';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment