fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. const int MAX_SIZE = 10;
  6.  
  7. bool only(char word[], char x, char y, char z) {
  8. for (int i = 0; i < strlen(word); ++i) {
  9. if (word[i] != x || word[i] != y || word[i] != z) {
  10. return false;
  11. }
  12. }
  13. return true;
  14. }
  15.  
  16. int main() {
  17. char x, y, z;
  18. int n;
  19. cin >> x >> y >> z;
  20. cin >> n;
  21. for (int i = 1; i <= n; ++i) {
  22. char word[MAX_SIZE + 1];
  23. cin >> word;
  24. if (only(word,x,y,z)) {
  25. cout << word << '\n';
  26. }
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5272KB
stdin
a b c
1
a
stdout
Standard output is empty