[1408] Dolly Song

  • 问题描述
  • Please listen to this song. Is it familiar?

    You know, the lyrics is "ba la du la di li @&**(&#(!*@&#(*!@&#(*!@&#". Well it's just a joke.

    We need you to caculate how many syllables in this song.

    To simplify this problem, we just assume a consonant followed a vowel(AEIOU) called a

    syllable. For examples, 'ba', 'la', 'du' and so on are syllables.

    You should caculate out the count of each syllable.

  • 输入
  • This problem contains several cases.
    Each case is a line of string with only lowercase letters. (No longer than 65535)
  • 输出
  • For each case, you should list all of the appeared syllables sorted by lexicographical and its times.

    找出所有的形如ab的字符串,其中a为辅音,b为元音
    #include<stdio.h>
    #include<string.h>
    
    int num[30][30];
    bool judge(char a,char b)
    {
    	if(a!='a' && a!='e' && a!='i' && a!='o' && a!='u')
    	   if(b=='a'|| b=='e' || b=='i' || b=='o' || b=='u' )
    	      return true;
        return false;
    }
    int main()
    {
        char a,b,temp;
        while(~scanf("%c%c",&a,&b))
        {
        	int i=0,j;
        	memset(num,0,sizeof(num));
            while(scanf("%c",&temp))
            {
                if(temp=='\n')
                    break;
                if(judge(a,b))
                	num[a-'a'][b-'a']++;
                a=b;
                b=temp;
            }
            if(judge(a,b))
           	    num[a-'a'][b-'a']++;
            for(i=0;i<30;i++)
              for(j=0;j<30;j++)
                if(!num[i][j])
                  continue;
                else
                  printf("%c%c %d\n",i+'a',j+'a',num[i][j]);
    
        }
        return 0;
    
    }


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值