Printing Characters with its count in a String Using C program(Case Insensitive)
Printing Characters with its
count in a string(Case insensitive):
C Program:
Output 1:
Output 2:
From the above program,
ü a[i] is the character used for comparing.
ü a[j] is the character to be compared with
a[i].
ü For every i increament, the count is
initialized to 1, count gets increased whenever the character used for
comparing gets repeated i.e a[i].
ü The above lines used to compare the
characters in the string one by one, when the repeated character comes then its
value is assigned to '0'(a[j]='0') and count is increased by 1.
ü a[i]!=' ', this condition is used to
not remove the repeated blank space from the string.
ü The above lines used to print the count of
the repeated characters in the given string.
ü The above line used to print the count of the non repeated
character(Whose count will be 1) in the given string.
Note: Printing Characters with itscount in a string(Case Sensitive)
0 Comments