Skip to main content

The best Internet Browser- Hackerearth

Hello,
This section is introducing for solving the problem from Coding skill challenges website like Hackerearth.com and  Hackerrank.com. so visit to these website , read the questions and try to solve it yourself first but some how if you need any help then see solution here .
Problem – 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!
SAMPLE INPUTSAMPLE OUTPUT
2
http://www.google.com7/14
http://www.hackerearth.com11/19
Explanation
Consider the first case:
In Jhool’s browser, you’ll only have to type: ggl.com (7 characters) while in a normal browser, you’ll have to type http://www.google.com, which is 14 characters.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class MyClass
{
static void Main(string[] args)
{
string vowels = "aeiou";
 
string removeText = "www.";
 
List objVal = new List();
 
int i = Convert.ToInt32(Console.ReadLine());
 
for (int j = 0; j <i> !vowels.Contains(c)).ToArray());
 
Console.WriteLine(newString.Length + "/" + result.Length);
 
}
 Console.Read();
}
 
}
Just go through with code and run it . expected output will come.
hackprog1
Thanks for reading this article .
Happy coding   🙂

Comments

Popular posts from this blog

Extension method using DLL in C#

Hello Guys, In this article i will explain what is extension method and why and where we should use this . Let’s understand the term extension means we are going to create something new with the help of old made things or objects etc . right ? so this is very predictable word in real world. On other hand in programming world this meaning is almost same with some new enhancements. Let’s see the professional definition in terms of oops. Extension method is special kind of static method which we can access throughout or outside of program. Extension method help us to extend the class with new methods without any changes in base type or class . We can create new methods in the dll library class also without changing the old code though extension method. Let’s see the simple example of extension method . 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 using System; namespace csharpdemoexample { public s...