Advertisement
wkkw0203

4.2

Oct 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. uint32_t zlicz_rozne(string t)
  6. {
  7. uint32_t wystepuje[26];
  8. for(int i=0; i<26; i++)
  9. wystepuje[i]=0;
  10. for(int i=0; i<t.length(); i++)
  11. wystepuje[(int)(t[i]-'A')]=1;
  12. uint32_t zlicz=0;
  13. for(int i=0; i<26; i++)
  14. if(wystepuje[i]==1)
  15. zlicz++;
  16. return zlicz;
  17. }
  18.  
  19. int main()
  20. {
  21. string c;
  22. string p="";
  23. uint32_t maxi=0, z;
  24. for(int i=1; i<=1000; i++)
  25. {
  26. cin>>c;
  27. z = zlicz_rozne(c);
  28. if (z>maxi){
  29. maxi = z;
  30. p=c;
  31. }
  32. }
  33. cout << p << " " << maxi << endl;
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement