Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- int t, i, j, count, n, flag;
- char grid[1005][105], str[105];
- scanf("%d", &t);
- while(t--){
- scanf("%d", &n);
- memset(grid, '\0', sizeof(grid));//setting all elements to NULL
- count = 0;
- for(i = 0; i < n; i++){
- scanf("%s", str);
- flag = 0;//no match found
- for(j = 0; j < i; j++){
- if(strcmp(grid[j], str) == 0){
- flag = 1;// at least one match found
- break;
- }
- }
- if(flag == 0){//if no match found
- strcpy(grid[j], str);
- count++;
- }
- }
- printf("%d\n", count);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement