Leaderboard
Showing:
Difficulty of sentence
Basic Accuracy: 43.87% Submissions: 260 Points: 1

Given a sentence as a string S. Calculate difficulty of a given sentence.

Difficulty of sentence is defined as 5*(number of hard words) + 3*(number of easy words). A word in the given string is considered hard if it has 4 consecutive consonants or number of consonants are more than number of vowels. Else the word is easy.
Note: uppercase and lowercase characters are same.

Example

Input:
S = "Difficulty of sentence"
Output:
13
Explanation:
2 hard words + 1 easy word

Example

Input:
S = "I am good"
Output:
9
Explanation:
3 easy words
Your task:
You don't have to read input or print anything. Your task is to complete the functioin calcDiff() which takes the string S as input and returns the difficulty of the sentence.
 

Expected Time Complexity : O(len(s)
Expected Auxilliary Space : O(1)

Constraints:
1<= length( S ) <= 105

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Difficulty of sentence

Output Window