So I have this problem where I need to use the grep command.
So I got 52 cards of 13 ranks and 4 colors. 

The ranks consist of A,2,3,4,5,6,7,8,9,T(for ten),J,Q and K(king). The four colors: c,d,h,s.

Now I've got file (cards.txt) with all possible combinations of 13 cards.
Example: 8cKc6s4dKd8sQc4c2s6h9dTc4h

Now the question is output all combinations that contains 4 cards of the same ranks. 

β = { h ∈ H | h contains 4 cards of the same ranks}.
examples:

Kd9dJs5sKs7c5c6cKcJhKhTh7h ∈ β

AdTdTc2d2cTsKh6c3c6s6dKc4h ∉ β

(Problem is I know how to use grep command for sequence of characters but only when they're next to each other. Help plz)