/*
D - Nineteen
Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u
Submit
 
Status
 
Practice
 
CodeForces 393A
Description
Alice likes word "nineteen" very much. She has a string s and wants the string to contain as many such words as possible. For that reason she can rearrange the letters of the string.

For example, if she has string "xiineteenppnnnewtnee", she can get string "xnineteenppnineteenw", containing (the occurrences marked) two such words. More formally, word "nineteen" occurs in the string the number of times you can read it starting from some letter of the string. Of course, you shouldn't skip letters.

Help her to find the maximum number of "nineteen"s that she can get in her string.

Input
The first line contains a non-empty string s, consisting only of lowercase English letters. The length of string s doesn't exceed 100.

Output
Print a single integer — the maximum number of "nineteen"s that she can get in her string.

Sample Input
Input
nniinneetteeeenn
Output
2
Input
nneteenabcnneteenabcnneteenabcnneteenabcnneteenabcii
Output
2
Input
nineteenineteen
Output
2
By Grant Yuan
2014.7.11*/
#include<iostream>
#include<stdio.h>

#include<stdlib.h>
#include<string.h>
using namespace std;
char a[102];
char b[4]={'n','i','e','t'};
int c[4];
int main()
{
   memset(c,0,sizeof(c));
   cin>>a;
   int l,t;
   l=strlen(a);
   //cout<<l<<endl;
   for(int i=0;i<l;i++)
      for(int j=0;j<4;j++)
        if(a[i]==b[j])
          c[j]++;
          //c[0]=c[0]/3;
          c[2]=c[2]/3;
    int min=c[0];
    for(int i=0;i<4;i++)
      if(c[i]<min)
        min=c[i];
       /* if(min==1)
           if(c[0]<3) min=0;
        else {if(min>1)
           //if(c[0]<3+(min-1))
           t=(c[0]-3)/2;
    if(t<min) min=t;}*/
    int j;
    if(min>0)
      if(c[0]<1+2*min){
         for(j=min;j>0;j--)
            {if(c[0]>=1+2*j)
               break;}
               min=j;}
    cout<<min<<endl;
    return 0;
}


优质内容筛选与推荐>>
1、Sublime Text3配置Node.js开发环境
2、[ISSUE] Pick Stone
3、[转]mysql如何利用Navicat 导出和导入数据库
4、数据库常用函数整理
5、深入java虚拟机学习 -- 类的加载机制


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号