poj 2608 Soundex

poj 2608 Soundex,第1张

poj 2608 Soundex
#include <stdio.h>#include <string.h>int change(char c){    if(c == 'B' || c == 'F' || c == 'P' || c == 'V')        return 1;    else if(c == 'C' || c == 'G' || c == 'J' || c == 'K' || c == 'Q' || c == 'S' || c == 'X' || c == 'Z')        return 2;    else if(c == 'D' || c == 'T')        return 3;    else if(c == 'L')        return 4;    else if(c == 'M' || c == 'N')        return 5;    else if(c == 'R')        return 6;    else        return 0;}int main(){    int i,j,k;    char str[25];    while(scanf("%s",str) != EOF)    {        int l = strlen(str);        int cnt = -1;        for(i=0; i<l; i++)        { int tmp = change(str[i]); if(tmp != cnt && tmp > 0)     printf("%d",tmp); cnt = tmp;        }        printf("n");    }    return 0;}

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4882768.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-11
下一篇2022-11-11

发表评论

登录后才能评论

评论列表(0条)

    保存