ITP1_8_C: Counting Characters

「ITP1_8_C: Counting Characters」の編集履歴(バックアップ)一覧はこちら

ITP1_8_C: Counting Characters - (2016/03/22 (火) 09:08:51) の1つ前との変更点

追加された行は緑色になります。

削除された行は赤色になります。

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_C 文字列中の各アルファベットの個数をこたえる問題。 #include <iostream> #include <stdio.h> #include <ctype.h> using namespace std; int main() { // your code goes here int counts[30]={0}; char cs[1201]; while(scanf("%[^\n]\n",cs)!=EOF){ for(int i=0;cs[i]!='\0';i++){ if(isalpha(cs[i])){ counts[tolower(cs[i])-'a']++; } } } for(char c='a';c<='z';c++){ printf("%c : %d\n",c,counts[c-'a']); } return 0; }
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_C 文字列中の各アルファベットの個数をこたえる問題。 #include <iostream> #include <stdio.h> #include <ctype.h> using namespace std; int main() { // your code goes here int counts[30]={0}; char cs[1201]; while(scanf("%[^\n]\n",cs)!=EOF){ for(int i=0;cs[i]!='\0';i++){ if(isalpha(cs[i])){ counts[tolower(cs[i])-'a']++; } } } for(char c='a';c<='z';c++){ printf("%c : %d\n",c,counts[c-'a']); } return 0; }

表示オプション

横に並べて表示:
変化行の前後のみ表示: