fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. bool isCharacter(char c[]) {
  6. int n = strlen(c);
  7. for (int i = 0; i < n; ++i) {
  8. if ('A' <= c[i] && 'Z' >= c[i]) {
  9. return true;
  10. }
  11. }
  12. return false;
  13. }
  14.  
  15. int main() {
  16. char whereToSearch[100], whatINeed[100];
  17. cin.getline(whereToSearch, 100);
  18. cin.getline(whatINeed, 100);
  19. int n = strlen(whereToSearch);
  20. int m = strlen(whatINeed);
  21. bool found = false;
  22. for (int i = 0; i <= n - m; ++i) {
  23. found = true;
  24. if (isCharacter(whereToSearch)) {
  25. return 0;
  26. }
  27. for (int j = 0; j < m; ++j) {
  28. if (whereToSearch[i + j] != whatINeed[j]) {
  29. found = false;
  30. break;
  31. }
  32. }
  33. if (found) {
  34. cout << "DA";
  35. return 0;
  36. }
  37. }
  38. cout << "NU";
  39. return 0;
  40. }
Success #stdin #stdout 0.01s 5276KB
stdin
foarmatul de prograM
ram
stdout
Standard output is empty