Input
The program will accept a single text input.
Output
After the user encodes his/her text input, the program examines the text's structure which includes:
sample Input
october/15/1975
Sample Output
7:letters
6:numbers
2:special-characters
3:ooe
4:ctbr
6:151975
2://
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include<ctype.h>
#define SIZE 200Â
int main()
{
  char string[SIZE];
  int alphabet, numbers, special_characters, x;
  alphabet = numbers = special_characters = x = 0;
    printf("\n\nEnter the string :\n");
  Â
    fgets(string, sizeof string, stdin);
  Â
  while(string[x]!='\0')
  {
    if((string[x]>='a' && string[x]<='z') || (string[x]>='A' && string[x]<='Z'))
    {
      alphabet++;
    }
    else if(string[x]>='0' && string[x]<='9')
    {
      numbers++;
    }
    else
    {
      special_characters++;
    }
    Â
    Â
    x++;
  }
   Â
  printf("\n%d: letters\n", alphabet);
  printf("%d: numbers\n", numbers);
  printf("%d: special-characters\n\n", special_characters-1);
}
Comments
Leave a comment