• Source
    1. #include<stdio.h>
    2. #include<iostream>
    3. #include<string.h>
    4.  
    5. using namespace std;
    6.  
    7. int main()
    8. {
    9. string s,s1;
    10. int test,q;
    11.  
    12. scanf("%d",&test);
    13.  
    14. while(test--)
    15. {
    16. cin>>s;
    17.  
    18. scanf("%d",&q);
    19.  
    20. while(q--)
    21. {
    22. cin>>s1;
    23. if(s.substr(0,s1.length())==s1)
    24. {
    25. printf("y\n");
    26. }
    27. else
    28. {
    29. printf("n\n");
    30. }
    31. }
    32. }
    33.  
    34. return 0;
    35. }