输入一个由小写字母组成的英文单词,输出用手机的默认英文输入法的敲键序列。例如要打出pig这个单词,需要按1次p,3次i,(稍作停顿后)1次g,记为p1i3g1。
#include<stdio.h>
#include<string.h>
#define MAXN 50
int main()
{
char word[MAXN],*p,*keyBd[8]={"abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
int i,j,len;
fgets(word,sizeof(word),stdin);
len=strlen(word);
for(i=0;i<len;i++)
{
for(j=0;j<8;j++)
{
if(p=strchr(keyBd[j],word[i]))
{
printf("%c%d",word[i],p-keyBd[j]+1);
}
}
}
}