fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. string q;
  5. while(cin>>q && q!="#") {
  6. int k=1,t=0,pos=0;
  7. string tmp;
  8. if(q[0]=='K')
  9. t++;
  10. while(k<52) {
  11. cin>>q;
  12. k++;
  13. if(q[0]=='K') t++;
  14. if(t==4){
  15. pos=k;
  16. tmp=q;
  17. t=-1;
  18. }
  19. }
  20. if(pos<10)
  21. cout<<"0"<<pos<<","<<tmp<<endl;
  22. else
  23. cout<<pos<<","<<tmp<<endl;
  24. }
  25. }
Success #stdin #stdout 0s 15232KB
stdin
TS  QC  8S  8D  QH  2D  3H  KH  9H  2H  TH  KS  KC
9D  JH  7H  JD  2S  QS  TD  2C  4H  5H  AD  4D  5D
6D  4S  9S  5S  7S  JS  8H  3D  8C  3S  4C  6S  9C
AS  7C  AH  6H  KD  JC  7D  AC  5C  TC  QD  6C  3C
#
stdout
44,KD