fork download
  1. //teja349
  2. #include <bits/stdc++.h>
  3. #include <vector>
  4. #include <set>
  5. #include <map>
  6. #include <string>
  7. #include <cstdio>
  8. #include <cstdlib>
  9. #include <climits>
  10. #include <utility>
  11. #include <algorithm>
  12. #include <cmath>
  13. #include <queue>
  14. #include <stack>
  15. #include <iomanip>
  16. #include <ext/pb_ds/assoc_container.hpp>
  17. #include <ext/pb_ds/tree_policy.hpp>
  18. //setbase - cout << setbase (16); cout << 100 << endl; Prints 64
  19. //setfill - cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
  20. //setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
  21. //cout.precision(x) cout<<fixed<<val; // prints x digits after decimal in val
  22.  
  23. using namespace std;
  24. using namespace __gnu_pbds;
  25.  
  26. #define f(i,a,b) for(i=a;i<b;i++)
  27. #define rep(i,n) f(i,0,n)
  28. #define fd(i,a,b) for(i=a;i>=b;i--)
  29. #define pb push_back
  30. #define mp make_pair
  31. #define vi vector< int >
  32. #define vl vector< ll >
  33. #define ss second
  34. #define ff first
  35. #define ll long long
  36. #define pii pair< int,int >
  37. #define pll pair< ll,ll >
  38. #define sz(a) a.size()
  39. #define inf (1000*1000*1000+5)
  40. #define all(a) a.begin(),a.end()
  41. #define tri pair<int,pii>
  42. #define vii vector<pii>
  43. #define vll vector<pll>
  44. #define viii vector<tri>
  45. #define mod (1000*1000*1000+7)
  46. #define pqueue priority_queue< int >
  47. #define pdqueue priority_queue< int,vi ,greater< int > >
  48. #define flush fflush(stdout)
  49. #define primeDEN 727999983
  50. mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  51.  
  52. // find_by_order() // order_of_key
  53. typedef tree<
  54. int,
  55. null_type,
  56. less<int>,
  57. rb_tree_tag,
  58. tree_order_statistics_node_update>
  59. ordered_set;
  60.  
  61. int haha[1234],arr[1234];
  62.  
  63. int main(){
  64. std::ios::sync_with_stdio(false); cin.tie(NULL);
  65. int t;
  66. cin>>t;
  67. int i,j;
  68. string gg="codechef";
  69. rep(i,gg.length()){
  70. haha[gg[i]]++;
  71. }
  72. while(t--){
  73. int n;
  74. cin>>n;
  75. string s;
  76. rep(i,500){
  77. arr[i]=0;
  78. }
  79. rep(i,n){
  80. cin>>s;
  81. rep(j,s.length()){
  82. arr[s[j]]++;
  83. }
  84. }
  85. int ans=inf;
  86. rep(i,500){
  87. if(haha[i]==0)
  88. continue;
  89. ans=min(ans,arr[i]/haha[i]);
  90. //cout<<arr[i]<<" "<<haha[i]<<" "<<ans<<endl;
  91. }
  92. cout<<ans<<endl;
  93. }
  94. return 0;
  95. }
Success #stdin #stdout 0s 15248KB
stdin
Standard input is empty
stdout
0