fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. string s1,s2;
  5. int res=0;
  6.  
  7. int main(){
  8. ios_base::sync_with_stdio(false);
  9. cin.tie(NULL);
  10. cout.tie(NULL);
  11. // freopen("soluong.inp","r",stdin);
  12. // freopen("soluong.out","w",stdout);
  13. cin>>s1>>s2;
  14. for(int i=0;i<=s1.length();i++){
  15. if(int(s1[i])==int(s2[i])){
  16. res++;
  17. }
  18. }
  19. cout<<res<<"\n";
  20. }
  21.  
Success #stdin #stdout 0s 5376KB
stdin
ABAABCD
BAADCCB
stdout
3