In this program, all the subsets of the string need to be printed. The subset of a string is the character or the group of characters that are present inside the string. For example, all possible subsets of a string "FUN" will be F, U, N, FU, UN, FUN.
Algorithm
- Define a string.
- If any character in the string is matched with (! , . , ' , - , " , ? , ; ) , increment the count by 1.
- Print the count.
Complexity:
O(n)
Input:
char str [] = "Good Morning! Mr. James Potter. Had your breakfast?"
Output:
If any character in the string is matched with ('!', "," ,"\'" ,";" ,"\"", ".", "-" ,"?"), increment the count by 1.
Total number of punctuation characters exists in string: 4
Python
Output:
C
Output:
JAVA
Output:
C#
Output:
PHP
Output: