fork download
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5.  
  6. char s1[101], s2[101];
  7.  
  8. int main() {
  9. cin.getline(s1, 101);
  10. cin.getline(s2, 101);
  11. int lungime1 = strlen(s1);
  12. int lungime2 = strlen(s2);
  13. for (int i = 0; i < lungime1; ++i){
  14. if (s1[i] == s2[0]){
  15. int j = 1;
  16. ++i;
  17. while (s1[i] == s2[0] && j < lungime2){
  18. ++i; ++j;
  19. }
  20. if (j == lungime2){
  21. cout << "DA";
  22. return 0;
  23. }
  24. }
  25. }
  26. cout << "NU";
  27. }
  28.  
Success #stdin #stdout 0.01s 5324KB
stdin
invatam informatica
am in
stdout
NU