fork download
  1. #include <bits/stdc++.h>
  2. #define tal2a ios::sync_with_stdio(false); cin.tie(nullptr);
  3. #define lolo long long
  4. const double PI = acos(-1.0);
  5. using namespace std;
  6. int main()
  7. {
  8. freopen("input.txt", "r", stdin);
  9. freopen("output.txt", "w", stdout);
  10. freopen("errors.txt", "w", stderr);
  11. tal2a;
  12. string s; cin>>s;
  13. int cnt=0;
  14. int e=0,g=0,y=0,p=0,t=0;
  15. for(int i=0;i<s.size();i++) {
  16. s[i]=toupper(s[i]);
  17. if (s[i]=='E')e++;
  18. else if (s[i]=='G')g++;
  19. else if (s[i]=='Y')y++;
  20. else if (s[i]=='P')p++;
  21. else if (s[i]=='T')t++;
  22.  
  23. if (e>=1&&g>=1&&y>=1&&p>=1&&t>=1) {
  24. cnt++;
  25. e--,g--,y--,p--,t--;
  26.  
  27. }
  28.  
  29. }
  30. cout<<cnt;
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty