fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. string A="utyuyty";
  7. string B="yyt";
  8. int n1=A.size();
  9. int n2=B.size();
  10. int i=0;
  11. int j=0;
  12. int count=0;
  13. while(i<n1 && j<n2){
  14. if(A[i]==B[j]){
  15. count++;
  16. i++;
  17. j++;
  18. }
  19. else{
  20. i++;
  21. }
  22. }
  23. if(count==n2){
  24. cout<<"string appears";
  25. }
  26. else{
  27. cout<<"String does not appears";
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
string appears