P13338 [CodeChef] fest03
NOI
题目描述

Golu is a student of Computer Engineering and he decided to make a project for himself.So he started working on URL shortner.While working on project he got confused.You are a good friend of Golu so he asked you for help.
You have given a link and you have to convert it into a short link using algorithm given by Golu.
Your Task is simple.You have to find 3 most occuring alphabets a1,a2,a3 with three counts n1,n2,n3 respectively in the original link.
Then shorten link=ocul.in/a1n1a2n2a3n3.
e.g. if original link=facebook.com/home/
then shorten link=ocul.in/o4c2e2

Input

The first line of the input contains an integer T denoting the number of test cases.
In next T lines contains a string(original Url).

Output

For every Url there are a shorten link as a output..

Constraints

1 ≤ T ≤ 10^5
1 ≤ length of string ≤ 10^5

Example
Input:
3
codechef.com
facebook.com/home/
ssss

Output:
ocul.in/c3e2o2
ocul.in/o4c2e2
ocul.in/s4a0a0

Code

include<stdio.h>

char s[100000];
{
long long int t;
long long int a[26],i,j;
scanf("%lld",t);
while(t--)
{
long long int max=0;
scanf("%s",a);
for(i=0;i>0;i++)
if(s[i] ≥ 'a'&&s[i]<='z')a[s[i]-'a']++;
printf("ocul.in/");
for(i=0;i<3;i++)
{
for(j=0;j<26;j++)
if(a[j]>a[max])max=j;
printf("%d%d",max+97,a[max]);
a[max]=0;
}
}
}

Steps to be followed

  1. Read the given description carefully and understand the problem.

  2. Analyze the code given in the problem and find bugs(errors) in these codes..

  3. The given code can be copied and compiled in an online compiler (Eg. ideone.com).

  4. Once the bugs are eliminated from the code, the clean code can be submitted as the solution to the problem..

  5. The solution should be a debugged version of the code provided and must satisfy the test cases to be accepted..

输入格式

见题面

输出格式

见题面

样例输入
3 codechef.com facebook.com/home/ ssss
样例输出
ocul.in/c3e2o2 ocul.in/o4c2e2 ocul.in/s4a0a0