fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int acc=0 ;
  6. string a , b ;
  7. cin>>a>>b ;
  8. if (a.size() < 8 ){
  9. for(int i=0 ;i<a.size() ;i++ ){
  10. if (a[i] == b[i] )
  11. acc++;
  12. }
  13. cout<<acc<<endl;
  14. if ( acc == a.size() ){
  15. cout<<"yes";
  16. return 0 ;
  17. }
  18. }
  19. else if ( a.size() >= 8) {
  20. if ( a.size()- b.size() == 1 || a.size() == b.size() ){
  21. for(int j=0 ;j< a.size() ;j++ )
  22. if (a[j] == b[j])
  23. acc++;
  24. }
  25. cout<<acc<<endl;
  26. if (acc==a.size() || acc==a.size() -1 ){
  27. cout<<"yes"<<endl;
  28. return 0 ;
  29. }
  30. }
  31. cout<<"no "<<endl;
  32. return 0;
  33. }
Success #stdin #stdout 0s 3472KB
stdin
algorithms
algorthms
stdout
5
no