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{
  20. for (int i=0 ;i< a.size() ;i++ ){
  21. if ( a.size() >= 8) {
  22. if ( a.size()- b.size() == 1 || a.size() == b.size() ){
  23. for(int j=0 ;j< a.size() ;j++ )
  24. if (a[j] == b[j])
  25. acc++;
  26. }
  27.  
  28. }
  29. }
  30. cout<<acc<<endl;
  31. if (acc==a.size() || acc==a.size() -1 ){
  32. cout<<"yes"<<endl;
  33. return 0 ;
  34. }
  35. }
  36. cout<<"no "<<endl;
  37. return 0;
  38. }
Success #stdin #stdout 0s 3472KB
stdin
ofmahone
ofmahome
stdout
56
no