fork download
  1. //
  2. // Created by nyanmaruk on 14/04/2024.
  3. //
  4. #include <stdio.h>
  5. #include <string.h>
  6.  
  7.  
  8. int checlCharinString(char *str, char c){
  9. int i = 0;
  10. while (i < 10){
  11. if (str[i] == c){
  12. return 1;
  13. }
  14. i++;
  15. }
  16. return 0;
  17. }
  18.  
  19. int main(){
  20. int n;
  21. scanf("%d", &n);
  22. int lenght[n];
  23. char names[n][10];
  24. for (int i = 0; i<n; i++){
  25. scanf("%d", &lenght[i]);
  26. scanf("%s\n", names[i]);
  27. }
  28.  
  29. for (int i =0; i<n; i++){
  30. int count = 0;
  31. for (int j=0; j<lenght[i]; j++){
  32. if (checlCharinString("Timur", names[i][j]) == 1){
  33. count++;
  34. }
  35. }
  36. int len = strlen("Timur");
  37. if (count == len){
  38. printf("YES\n");
  39. }
  40. else {
  41. printf("NO\n");
  42. }
  43. }
  44. }
Success #stdin #stdout 0s 5280KB
stdin
10
5
Timur
5
miurT
5
Trumi
5
mriTu
5
timur
4
Timr
6
Timuur
10
codeforces
10
TimurTimur
5
TIMUR
stdout
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO