fork(1) download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. cin >> n;
  8. char array[100];
  9. cin.getline(array, 101);
  10. cin.getline(array, 101);
  11. char word[100];
  12. int countArray = strlen(array), countWords = 0;
  13. for (int j = 0; j < n; ++j) {
  14. cin.getline(word, 101);
  15. int countWord = strlen(word), correct = 0;
  16. for (int i = 0; i < countArray && i < countWord; ++i) {
  17. if (array[countArray - i - 1] != word[countWord - i - 1]) {
  18. ++correct;
  19. }
  20. }
  21. if ((countWord - countArray) >= 1 && correct == 0) {
  22. ++countWords;
  23. }
  24. }
  25. cout << countWords;
  26. }
Success #stdin #stdout 0s 544KB
stdin
5
are
programare
imbunatatire
prezentare
are
intrebaree
stdout
2