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. if ( acc == a.size() ){
  14. cout<<"yes";
  15. return 0 ;
  16. }
  17. }
  18. else if ( a.size() >= 8) {
  19. if ( a.size()- b.size() == 1 || a.size() == b.size() ){
  20. for(int j=0 ;j< a.size() ;j++ ){
  21. if (a[j] == b[j])
  22. acc++;
  23. else if ( a[j+1] == b[j] )
  24. acc++;
  25. }
  26. }
  27. if (acc==a.size() || acc==a.size() -1 ){
  28. cout<<"yes"<<endl;
  29. return 0 ;
  30. }
  31. }
  32. cout<<"no "<<endl;
  33. return 0;
  34. }
Success #stdin #stdout 0s 3472KB
stdin
AgentMahone
IslamIsMahone
stdout
no