The best Internet Browser

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.

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 Input
(Plaintext Link)

2
www.google.com
www.hackerearth.com

Sample Output
(Plaintext Link)

7/14
11/19

import java.util.Scanner;

public class TheBestInternetBrowser
{
public static void main(String[] args)
       {
Scanner scn=new Scanner(System.in);
int s=scn.nextInt();
String [] arr=new String[s];
for(int i=0;i<arr.length;i++)
{
arr[i]=scn.next();
}
for(String str:arr)
{
filter(str);
}

}
public static void filter(String s)
{
char l;
String nw="";
boolean b= false;
for(int i=4;i<s.length();i++)
{
l=Character.toLowerCase(s.charAt(i));

if(b==false)
            {
if(l=='a' ||l=='e' ||l=='i' ||l=='o' ||l=='u')
{

}
else if(l=='.')
{
nw+=l;
b=true;
}
                    else
                   {
nw+=l;
}
}
else
             {
nw+=l;
}
 
}
System.out.println(nw);
System.out.println(nw.length()+"/"+s.length());

}
}

Post a Comment

Previous Post Next Post