fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int j=0;
  7. int cnt =0 ;
  8. for( int i=0; i<A.length(); i++ )
  9. {
  10. if( A[0]!=p[0] )
  11. return 0;
  12. else
  13. {
  14. if( A[i]==p[j] && flag ==0 )
  15. {
  16. if( p[j] == '#' )
  17. {
  18. j=j+2;
  19. flag = 1;
  20. }
  21. else
  22. {
  23. j=j+1;
  24. flag = 0;
  25. }
  26. continue;
  27. }
  28. if( flag == 1 )
  29. {
  30. if( A[i]==p[j])
  31. flag =0;
  32. j++;
  33. continue;
  34. }
  35. if( flag ==0 && A[i]!=p[j] )
  36. return false;
  37. }
  38. }
  39. if( j!=p.length())
  40. return false;
  41. return 0;
  42. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:8:18: error: ‘A’ was not declared in this scope
  for( int i=0; i<A.length(); i++ )
                  ^
prog.cpp:10:13: error: ‘p’ was not declared in this scope
   if( A[0]!=p[0] )
             ^
prog.cpp:14:22: error: ‘flag’ was not declared in this scope
    if( A[i]==p[j] && flag ==0 )
                      ^~~~
prog.cpp:28:8: error: ‘flag’ was not declared in this scope
    if( flag == 1 )
        ^~~~
prog.cpp:35:8: error: ‘flag’ was not declared in this scope
    if( flag ==0 && A[i]!=p[j] )
        ^~~~
prog.cpp:39:9: error: ‘p’ was not declared in this scope
  if( j!=p.length())
         ^
stdout
Standard output is empty