fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int t;
  5. scanf("%d",&t);
  6. while(t>0)
  7. {
  8. char st[4];
  9. int ch,rep[100],count=0,i;
  10. scanf("%s",&st);
  11. for(i=0; i<4; i++)
  12. {
  13. ch=st[i];
  14. count=rep[ch];
  15. rep[ch]++;
  16.  
  17. }
  18. if(count==3)
  19. printf("-1\n");
  20. else if(count==2)
  21. printf("6\n");
  22. else if(count==1)
  23. printf("4\n");
  24. t--;
  25. }
  26. }
Success #stdin #stdout 0s 5316KB
stdin
3
0000
9876
3313
stdout
Standard output is empty