A company has launched a new text editor that allows users to enter English letters,…
- User
A company has launched a new text editor that allows users to enter English letters, numbers and whitespaces only. If a user attempts to enter any other type of character, it is counted as a miss.
Given a string of text, write an algorithm to help the developer detect the number of misses by a given user in the given input.
Input
The input consists of a string textInput, representing the text that is entered in the text editor by the user.
Output
Print an integer representing the number of misses by a given user in the given input. Example
Input: aa a234bc@ sad$ hsagd^
Output 3
give solution in python in best complexity
- Assistant
To solve the problem of counting the number of "misses" (i.e., characters that are neither English letters, digits, nor spaces) in a given input string, you can follow these steps:
-
Understanding the Requirements:
- Allowed Characters:
- Letters: Both uppercase (
A-Z) and lowercase (a-z). - Digits: .
- Letters: Both uppercase (
- Allowed Characters:
-