syhd142 |
|
|||
日歷
統計
導航常用鏈接留言簿(2)隨筆檔案(23)文章分類(270)
文章檔案(122)我的豆瓣搜索最新評論
閱讀排行榜
評論排行榜 |
拼寫檢查 #include <stdio.h>
#include <string.h> int hash[255]; void init() { hash['B'] = hash['F'] = hash['P'] = hash['V'] = 1; hash['C'] = hash['G'] = hash['J'] = hash['K'] = 2; hash['Q'] = hash['S'] = hash['X'] = hash['Z'] = 2; hash['D'] = hash['T'] = 3; hash['L'] = 4; hash['M'] = hash['N'] = 5; hash['R'] = 6; } int main() { init(); int ans[25], top; char data[25]; while(gets(data)) { top = 1; int l = strlen(data); for(int i = 0; i < l; i++) { int t = hash[data[i]]; if(t == ans[top - 1]) continue; ans[top++] = t; } for(int i = 1; i < top; i++) { if(ans[i]) printf("%d", ans[i]); } printf("\n"); } return 0; }
|
![]() |
|
Copyright © Fucker | Powered by: 博客園 模板提供:滬江博客 |