In the race for the best Internet browser, there's now a new contender for it, this browser is called the: "The Semantic Mind-Reader!" After its promo on the world wide web, everyone's been desperately waiting for the browser to be released. And why shouldn't they be curious about it, after all, it's the new project of our very own genius "Little Jhool!" He's worked very hard for this browser, and to add new mind reading features to it.
Apart from the various security powers it possesses, it's called the mind-reader for a reason. Here's why:
You don't need to type 'www.' to open a website anymore.
Though, you still need to type '.com' to open a website.
The browser predicts ALL THE VOWELS in the name of the website. (Not '.com', though. Again!)
Obviously, this means you can type the name of a website faster and save some time.
Now to convince users that his browser will indeed save A LOT of time for users to open a particular website, Little Jhool has asked you to prepare a report on the same.
Input format:
The first line contains tc, the number of test cases.
The second line contains the name of websites, as a string.
Output format:
You have to print the ratio of characters you would have typed in Jhool's browser, to your normal browser.
Constraints:
1 ≤ tc ≤ 100
1 ≤ Length of the website ≤ 200
NOTE: You do NOT need to print the output in its lowest format. You should print in its original fraction format.
The names of all the websites will be in small case only.
Every string will start from www. and end with .com, so well!
In Jhool's browser, you'll only have to type: ggl.com (7 characters) while in a normal browser, you'll have to type www.google.com, which is 14 characters.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
The browser predicts ALL THE VOWELS in the name of the website (not '.com' though). So essentially, when typing the name, you can skip typing vowels (a, e, i, o, u) in the main part of the domain name (i.e., the part between 'www.' and '.com').
Thus, for a given website name that always starts with "www." and ends with ".com", the number of characters typed in normal browser is the length of the whole string (including www. and .com). For Jhool's browser, we omit the initial "www." (so we don't type it), and we also omit all vowels in the main name (the part between www. and .com). But we still type ".com". Additionally, we should consider the dot before com? Actually the string has ".com" at the end, which includes the dot. In Jhool's browser, we still need to type ".com". So we need to compute the number of characters typed in Jhool's browser as: length of (name part without www. and without vowels) + length of ".com". But wait: Are we also allowed to omit the dot before com? The statement: "you still need to type '.com' to open a website." So presumably you type ".com". And the browser predicts all vowels in the name of the website, not '.com'. So you still have to type '.com' fully.
Thus, for a website string s = "www." + name + ".com", where name is the middle part (no dots presumably). In normal browser: length_total = len(s). In Jhool's browser: length_J = len(name_without_vowels) + len(".com") = (number of consonants in name) + 4 (since ".com" is 4 characters? Wait: ".com" includes the dot, so it's 4 characters? Let's count: '.' (1), 'c'(2), 'o'(3), 'm'(4). Yes, 4. But also, is there any dot between name and .com? Actually the string is "www.google.com". So the dot before com is part of the string. But careful: The domain name format is "www.google.com". The structure: "www." prefix, then the second-level domain "google", then ".com". So indeed the name part is "google". There's no extra dot after the name before .com; the dot is part of ".com". So if we remove "www.", we have "google.com". In Jhool's browser we would type only the consonants of "google" plus ".com". So the typed string would be "ggl.com"? Let's see: "google" consonants: g, g, l -> "ggl", then ".com" -> "ggl.com" total length: 3 + 4 = 7. That matches sample output: 7/14.
Second sample: "www.hackerearth.com". Normal length: count: w w w . h a c k e r e a r t h . c o m? Let's count precisely: "www.hackerearth.com". Actually the string: characters: 1:w,2:w,3:w,4:.,5:h,6:a,7:c,8:k,9:e,10:r,11:e,12:a,13:r,14:t,15:h,16:.,17:c,18:o,19:m. That's 19 characters. Wait sample output says 11/19, so Jhool's length is 11. Let's compute: name = "hackerearth". Vowels: a,e,e,a (plus maybe? h a c k e r e a r t h: vowels: a (pos2 in name? Actually name: h(1),a(2),c(3),k(4),e(5),r(6),e(7),a(8),r(9),t(10),h(11). Vowels: a, e, e, a => 4 vowels. So consonants count = 11 - 4 = 7. Then add 4 for ".com": 7+4 = 11. Yes.
So the calculation is correct.
Constraints: multiple test cases. Input format: first line contains tc, number of test cases. Then each test case on its own line? Sample input shows:
We need to output the ratio: characters typed in Jhool's browser over characters typed in normal browser, as a fraction in "original fraction format". That means we should not reduce the fraction. For example, 7/14 not 1/2. Also 11/19 cannot be reduced. So we simply output (J length)/(normal length) as is.
Thus solution: for each string s:
normal_len = len(s)
Remove "www." prefix? Actually we need to compute name part: between "www." and ".com". Since s always starts with "www." and ends with ".com", we can extract the substring between positions 4 and -5? Let's do: start_index = 4 (since "www." is 4 characters). end_index = len(s) - 4 (since ".com" is 4 characters). So name = s[4:-4] (if using Python slicing) or s[4:len(s)-4].
Count number of consonants (non-vowels) in name. Vowels are a, e, i, o, u (only lowercase, as per constraints).
jhool_len = consonant_count + 4 (for ".com").
Output f"{jhool_len}/{normal_len}"
Edge cases: If name empty? But constraints length at least 1, but after stripping www. and .com, name could be zero? Possibly a website like "www..com"? That doesn't make sense, but length of website ≥1, and string starts with "www." and ends with ".com", so minimal length would be 4+0+4=8, which would be "www..com"? Might not be typical, but we could handle: name = "" then consonant count = 0, jhool_len = 4, normal_len = 8. So ratio 4/8. That's fine.
Also, note: The browser predicts all vowels, meaning you don't have to type them. So indeed you type only consonants. So jhool_len = number of consonants + 4.
Implementation: Read integer t, then loop t times reading each line (strip newline). Compute.
Potential pitfalls: The input may have extra spaces? We should strip each line.
Also, note: The problem statement says: "Every string will start from *www. and end with *.com, so well!**" Probably meaning exactly that. So we can rely.
Now let's test with sample.
Write code accordingly.
Complexity trivial.
We'll produce solution in Python.
But note: The prompt seems to be from hackerearth maybe. We just need to provide a final answer code.
One more nuance: Are 'y' considered vowels? No, only a, e, i, o, u.
Thus final answer.
But let's read the problem carefully again to ensure we didn't misinterpret: "You don't need to type 'www.' to open a website anymore. Though, you still need to type '.com' to open a website. The browser predicts ALL THE VOWELS in the name of the website. (Not '.com', though. Again!) Obviously, this means you can type the name of a website faster and save some time." So indeed, the typed string is: name without vowels + ".com". There's no additional dot. The ".com" includes the dot. So we have that.
Also, the output ratio is Jhool's browser characters to normal browser characters. In sample, 7/14, 11/19.
Thus solution is straightforward.
We'll provide code:
def solve():
import sys
data = sys.stdin.read().splitlines()
if not data: return
t = int(data[0].strip())
out = []
vowels = set('aeiou')
for i in range(1, t+1):
s = data[i].strip()
normal = len(s)
name = s[4:-4] # remove "www." and ".com"
# Count consonants: letters that are not vowels.
cons = sum(1 for ch in name if ch not in vowels)
jhool = cons + 4
out.append(f"{jhool}/{normal}")
sys.stdout.write("\n".join(out))
Testing with sample.
Edge: If there are extra lines? No.
We should ensure that we handle case when name includes uppercase? "The names of all the websites will be in small case only." So only lowercase.
Thus done.
I'll provide explanation and code. ```python
import sys
def solve() -> None:
data = sys.stdin.read().splitlines()
if not data:
return
t = int(data[0].strip())
vowels = set('aeiou')
out_lines = []
for i in range(1, t + 1):
website = data[i].strip()
normal_len = len(website)
code
# remove "www." (first 4 chars) and ".com" (last 4 chars)
name = website[4:-4]
# count consonants in the name
consonant_count = sum(1 for ch in name if ch not in vowels)
jhool_len = consonant_count + 4 # +4 for ".com"
out_lines.append(f"{jhool_len}/{normal_len}")
sys.stdout.write("\n".join(out_lines))