Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Create 03_hw.c #974

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions A/04/03_hw.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <stdio.h>
#include <stdlib.h>
#include<string.h>

int main()
{
int n,i;
scanf("%d",&n);
int letters[26];
for (i=0;i<26;i++)
{
letters[i] = 0;
}
char in[1001];
fgets(in,1001,stdin);
for (i=0;i<strlen(in);i++)
{
if (in[i]>64&&in[i]<91) letters[in[i]-65]+=1;
if (in[i]>96&&in[i]<123) letters[in[i]-97]+=1;
}
for (i=0;i<26;i++)
{
if (letters[i]!=0)
{
printf("%c - ",97+i);
printf("%d\n",letters[i]);
}
}
return 0;
}