- Find number of special characters and whitespaces in the given message Wipro previous year coding question

 


Input:  a string str

Output: integer representing no of special characters and whitespaces in the given string

Example:

Input: Gassgg54@#vcsd!s*

Output: 4

Program:

n=input()

list1=list(n)

 count=0

for item in list1:

    if (ord(item)>=97 and ord(item)<=122) or (ord(item)>=65 and ord(item)<=90) or (ord(item)>=48 and ord(item)<=57):

        continue

    else:

        count+=1

print(count)


Post a Comment

Previous Post Next Post