Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question

(Consider the structure that the code must have. It is shown at the end of the task and the code must have the same structure)

Examples
Input
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
Output
word
110n
i18n
p43s
Requested files
Solution.java
1- public class Solution {
public static void main(String[] args) {
// add your code here
// code must use abbreviate() method as part of solution
}
2 -
4
6.
private static String abbreviate(String word) {
// add your code here
}
8
9
10
expand button
Transcribed Image Text:Examples Input 4 word localization internationalization pneumonoultramicroscopicsilicovolcanoconiosis Output word 110n i18n p43s Requested files Solution.java 1- public class Solution { public static void main(String[] args) { // add your code here // code must use abbreviate() method as part of solution } 2 - 4 6. private static String abbreviate(String word) { // add your code here } 8 9 10
Instructions:
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.
This abbreviation is made like this: we write down the first and the last letter of a word and between them, we write the number of letters between the first and
the last letters. That number is in decimal system and doesn't contain any leading zeroes.
Thus, "localization" will be spelled as "1On", and "internationalization» will be spelled as "il8n".
You are suggested to automatize the process of changing the words with abbreviations by using the Java program that implements the static method
capitalization((). At that, all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.
Input
The first line contains an integer n (1sns100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the
lengths of from 1 to 100 characters.
Output
Print n lines. The i-th line should contain the result of replacing of the ith word from the input data.
Examples
Input
4
word
expand button
Transcribed Image Text:Instructions: Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome. Let's consider a word too long if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation. This abbreviation is made like this: we write down the first and the last letter of a word and between them, we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes. Thus, "localization" will be spelled as "1On", and "internationalization» will be spelled as "il8n". You are suggested to automatize the process of changing the words with abbreviations by using the Java program that implements the static method capitalization((). At that, all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes. Input The first line contains an integer n (1sns100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters. Output Print n lines. The i-th line should contain the result of replacing of the ith word from the input data. Examples Input 4 word
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY