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. else if ( a[j+1] == b[j] )
  25. acc++;
  26. }
  27. }
  28. cout<<acc<<endl;
  29. if (acc==a.size() || acc==a.size() -1 ){
  30. cout<<"yes"<<endl;
  31. return 0 ;
  32. }
  33. }
  34. cout<<"no "<<endl;
  35. return 0;
  36. }
Success #stdin #stdout 0s 3472KB
stdin
Mahone
mahonE
stdout
4
no