-
-
Save Hacv16/082af5abcf64e7eb4303cb01ea16c08c to your computer and use it in GitHub Desktop.
OBI 2023 - Segunda Fase - P1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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