Prefixes of print
-
reprint
- noun a publication (such as a book) that is reprinted without changes or editing and offered again for sale
reissue; reprinting. - noun a separately printed article that originally appeared in a larger publication
offprint; separate.
- More ‘reprint’ Meaning
- reprint Associated Words
- reprint Prefix/Suffix Words
- reprint Related Words
- noun a publication (such as a book) that is reprinted without changes or editing and offered again for sale
-
blueprint
- noun something intended as a guide for making something else
pattern; design.- a blueprint for a house
- a pattern for a skirt
- noun photographic print of plans or technical drawings etc.
- More ‘blueprint’ Meaning
- blueprint Idioms/Phrases
- blueprint Associated Words
- blueprint Prefix/Suffix Words
- blueprint Related Words
- noun something intended as a guide for making something else
-
imprint
- noun a distinctive influence
- English stills bears the imprint of the Norman invasion
- noun a concavity in a surface produced by pressing
impression; depression.- he left the impression of his fingers in the soft mud
- More ‘imprint’ Meaning
- imprint Associated Words
- imprint Prefix/Suffix Words
- imprint Related Words
- noun a distinctive influence
-
fingerprint
- noun a print made by an impression of the ridges in the skin of a finger; often used for biometric identification in criminal investigations
- noun a generic term for any identifying characteristic
- that tax bill had the senator’s fingerprints all over it
- More ‘fingerprint’ Meaning
- fingerprint Idioms/Phrases
- fingerprint Associated Words
- fingerprint Prefix/Suffix Words
- fingerprint Related Words
-
sprint
- noun a quick run
dash. - verb run very fast, usually for a short distance
- More ‘sprint’ Meaning
- sprint Idioms/Phrases
- sprint Associated Words
- sprint Prefix/Suffix Words
- sprint Related Words
- noun a quick run
-
newsprint
- noun cheap paper made from wood pulp and used for printing newspapers
newspaper.- they used bales of newspaper every day
- More ‘newsprint’ Meaning
- newsprint Associated Words
- newsprint Related Words
- noun cheap paper made from wood pulp and used for printing newspapers
-
misprint
- noun a mistake in printed matter resulting from mechanical failures of some kind
typographical error; erratum; literal; typo; literal error. - verb print incorrectly
- More ‘misprint’ Meaning
- misprint Associated Words
- misprint Prefix/Suffix Words
- misprint Related Words
- noun a mistake in printed matter resulting from mechanical failures of some kind
-
overprint
- noun something added by overprinting
surprint. - verb print (additional text or colors) onto an already imprinted paper
print over.
- More ‘overprint’ Meaning
- overprint Associated Words
- overprint Prefix/Suffix Words
- overprint Related Words
- noun something added by overprinting
-
thumbprint
- noun fingerprint made by the thumb (especially by the pad of the thumb)
- More ‘thumbprint’ Meaning
- thumbprint Associated Words
- thumbprint Prefix/Suffix Words
- thumbprint Related Words
-
hoofprint
- noun a visible impression on a surface made by the hoof of an animal
hoof mark; hoof-mark.
- More ‘hoofprint’ Meaning
- hoofprint Associated Words
- hoofprint Prefix/Suffix Words
- hoofprint Related Words
- noun a visible impression on a surface made by the hoof of an animal
-
offprint
- noun a separately printed article that originally appeared in a larger publication
reprint; separate.
- More ‘offprint’ Meaning
- offprint Associated Words
- offprint Prefix/Suffix Words
- offprint Related Words
- noun a separately printed article that originally appeared in a larger publication
-
voiceprint
- noun biometric identification by electronically recording and graphically representing a person’s voice
- voiceprints are uniquely characteristic of individual speakers
- More ‘voiceprint’ Meaning
- voiceprint Associated Words
- voiceprint Prefix/Suffix Words
- voiceprint Related Words
- noun biometric identification by electronically recording and graphically representing a person’s voice
Suffixes of print
-
print
- noun the text appearing in a book, newspaper, or other printed publication
- I want to see it in print
- noun a picture or design printed from an engraving
- More ‘print’ Meaning
- printed Associated Words
- printed Prefix/Suffix Words
- printed Related Words
- noun the text appearing in a book, newspaper, or other printed publication
-
printing
- noun text handwritten in the style of printed matter
- noun the business of producing printed material for sale or distribution
- More ‘printing’ Meaning
- printing Idioms/Phrases
- printing Associated Words
- printing Prefix/Suffix Words
- printing Related Words
-
printer
- noun someone whose occupation is printing
pressman. - noun (computer science) an output device that prints the results of data processing
- More ‘printer’ Meaning
- printer Idioms/Phrases
- printer Associated Words
- printer Prefix/Suffix Words
- printer Related Words
- noun someone whose occupation is printing
-
print
- noun the text appearing in a book, newspaper, or other printed publication
- I want to see it in print
- noun a picture or design printed from an engraving
- More ‘print’ Meaning
- prints Associated Words
- prints Prefix/Suffix Words
- prints Related Words
- noun the text appearing in a book, newspaper, or other printed publication
-
printer
- noun someone whose occupation is printing
pressman. - noun (computer science) an output device that prints the results of data processing
- More ‘printer’ Meaning
- printers Associated Words
- printers Prefix/Suffix Words
- printers Related Words
- noun someone whose occupation is printing
-
printout
- noun the output of a computer in printed form
- More ‘printout’ Meaning
- printout Associated Words
- printout Prefix/Suffix Words
- printout Related Words
-
printing
- noun text handwritten in the style of printed matter
- noun the business of producing printed material for sale or distribution
- More ‘printing’ Meaning
- printings Associated Words
- printings Prefix/Suffix Words
- printings Related Words
-
printmaking
- noun artistic design and manufacture of prints as woodcuts or silkscreens
- More ‘printmaking’ Meaning
- printmaking Associated Words
- printmaking Related Words
-
printmaker
- noun an artist who designs and makes prints
graphic artist.
- More ‘printmaker’ Meaning
- printmaker Associated Words
- printmaker Prefix/Suffix Words
- printmaker Related Words
- noun an artist who designs and makes prints
-
printmaker
- noun an artist who designs and makes prints
graphic artist.
- More ‘printmaker’ Meaning
- printmakers Related Words
- noun an artist who designs and makes prints
-
printout
- noun the output of a computer in printed form
- More ‘printout’ Meaning
- printouts Associated Words
- printouts Related Words
-
printable
- adjective fit for publication because free of material that is morally or legally objectionable
- printable language
- More ‘printable’ Meaning
- printable Associated Words
- printable Prefix/Suffix Words
- printable Related Words
- adjective fit for publication because free of material that is morally or legally objectionable
Derived words of print
-
reprint
- noun a publication (such as a book) that is reprinted without changes or editing and offered again for sale
reissue; reprinting. - noun a separately printed article that originally appeared in a larger publication
offprint; separate.
- More ‘reprint’ Meaning
- reprinted Associated Words
- reprinted Prefix/Suffix Words
- reprinted Related Words
- noun a publication (such as a book) that is reprinted without changes or editing and offered again for sale
-
fingerprint
- noun a print made by an impression of the ridges in the skin of a finger; often used for biometric identification in criminal investigations
- noun a generic term for any identifying characteristic
- that tax bill had the senator’s fingerprints all over it
- More ‘fingerprint’ Meaning
- fingerprints Associated Words
- fingerprints Related Words
-
reprint
- noun a publication (such as a book) that is reprinted without changes or editing and offered again for sale
reissue; reprinting. - noun a separately printed article that originally appeared in a larger publication
offprint; separate.
- More ‘reprint’ Meaning
- reprints Associated Words
- reprints Prefix/Suffix Words
- reprints Related Words
- noun a publication (such as a book) that is reprinted without changes or editing and offered again for sale
-
blueprint
- noun something intended as a guide for making something else
pattern; design.- a blueprint for a house
- a pattern for a skirt
- noun photographic print of plans or technical drawings etc.
- More ‘blueprint’ Meaning
- blueprints Associated Words
- blueprints Related Words
- noun something intended as a guide for making something else
-
fingerprinting
- noun the procedure of taking inked impressions of a person’s fingerprints for the purpose of identification
- verb take an impression of a person’s fingerprints
fingerprint.
- More ‘fingerprinting’ Meaning
- fingerprinting Associated Words
- fingerprinting Related Words
-
imprint
- noun a distinctive influence
- English stills bears the imprint of the Norman invasion
- noun a concavity in a surface produced by pressing
impression; depression.- he left the impression of his fingers in the soft mud
- More ‘imprint’ Meaning
- imprints Associated Words
- imprints Related Words
- noun a distinctive influence
-
imprint
- noun a distinctive influence
- English stills bears the imprint of the Norman invasion
- noun a concavity in a surface produced by pressing
impression; depression.- he left the impression of his fingers in the soft mud
- More ‘imprint’ Meaning
- imprinted Associated Words
- imprinted Related Words
- noun a distinctive influence
-
imprinting
- noun a learning process in early life whereby species specific patterns of behavior are established
- verb establish or impress firmly in the mind
imprint; form.- We imprint our ideas onto our children
- More ‘imprinting’ Meaning
- imprinting Associated Words
- imprinting Related Words
-
sprint
- noun a quick run
dash. - verb run very fast, usually for a short distance
- More ‘sprint’ Meaning
- sprinted Associated Words
- sprinted Prefix/Suffix Words
- sprinted Related Words
- noun a quick run
-
reprinting
- noun a publication (such as a book) that is reprinted without changes or editing and offered again for sale
reprint; reissue. - verb print anew
reissue; reprint.- They never reprinted the famous treatise
- More ‘reprinting’ Meaning
- reprinting Associated Words
- reprinting Prefix/Suffix Words
- reprinting Related Words
- noun a publication (such as a book) that is reprinted without changes or editing and offered again for sale
-
fingerprint
- noun a print made by an impression of the ridges in the skin of a finger; often used for biometric identification in criminal investigations
- noun a generic term for any identifying characteristic
- that tax bill had the senator’s fingerprints all over it
- More ‘fingerprint’ Meaning
- fingerprinted Associated Words
- fingerprinted Related Words
-
sprint
- noun a quick run
dash. - verb run very fast, usually for a short distance
- More ‘sprint’ Meaning
- sprinting Associated Words
- sprinting Related Words
- noun a quick run
-
sprint
- noun a quick run
dash. - verb run very fast, usually for a short distance
- More ‘sprint’ Meaning
- sprints Associated Words
- sprints Prefix/Suffix Words
- sprints Related Words
- noun a quick run
-
sprinter
- noun someone who runs a short distance at top speed
- More ‘sprinter’ Meaning
- sprinter Associated Words
- sprinter Prefix/Suffix Words
- sprinter Related Words
-
sprinter
- noun someone who runs a short distance at top speed
- More ‘sprinter’ Meaning
- sprinters Associated Words
- sprinters Related Words
-
misprint
- noun a mistake in printed matter resulting from mechanical failures of some kind
typographical error; erratum; literal; typo; literal error. - verb print incorrectly
- More ‘misprint’ Meaning
- misprints Associated Words
- misprints Related Words
- noun a mistake in printed matter resulting from mechanical failures of some kind
-
overprint
- noun something added by overprinting
surprint. - verb print (additional text or colors) onto an already imprinted paper
print over.
- More ‘overprint’ Meaning
- overprinting Associated Words
- overprinting Related Words
- noun something added by overprinting
-
overprint
- noun something added by overprinting
surprint. - verb print (additional text or colors) onto an already imprinted paper
print over.
- More ‘overprint’ Meaning
- overprinted Associated Words
- overprinted Related Words
- noun something added by overprinting
-
hoofprint
- noun a visible impression on a surface made by the hoof of an animal
hoof mark; hoof-mark.
- More ‘hoofprint’ Meaning
- hoofprints Related Words
- noun a visible impression on a surface made by the hoof of an animal
-
misprint
- noun a mistake in printed matter resulting from mechanical failures of some kind
typographical error; erratum; literal; typo; literal error. - verb print incorrectly
- More ‘misprint’ Meaning
- misprinted Associated Words
- misprinted Related Words
- noun a mistake in printed matter resulting from mechanical failures of some kind
-
overprint
- noun something added by overprinting
surprint. - verb print (additional text or colors) onto an already imprinted paper
print over.
- More ‘overprint’ Meaning
- overprints Associated Words
- overprints Related Words
- noun something added by overprinting
-
reprinting
- noun a publication (such as a book) that is reprinted without changes or editing and offered again for sale
reprint; reissue. - verb print anew
reissue; reprint.- They never reprinted the famous treatise
- More ‘reprinting’ Meaning
- reprintings Associated Words
- reprintings Related Words
- noun a publication (such as a book) that is reprinted without changes or editing and offered again for sale
-
thumbprint
- noun fingerprint made by the thumb (especially by the pad of the thumb)
- More ‘thumbprint’ Meaning
- thumbprints Associated Words
- thumbprints Related Words
-
offprint
- noun a separately printed article that originally appeared in a larger publication
reprint; separate.
- More ‘offprint’ Meaning
- offprints Associated Words
- offprints Related Words
- noun a separately printed article that originally appeared in a larger publication
-
teleprinter
- noun a character printer connected to a telegraph that operates like a typewriter
telex machine; teletype machine; teletypewriter; telex.
- More ‘teleprinter’ Meaning
- teleprinter Associated Words
- teleprinter Prefix/Suffix Words
- teleprinter Related Words
- noun a character printer connected to a telegraph that operates like a typewriter
-
blueprint
- noun something intended as a guide for making something else
pattern; design.- a blueprint for a house
- a pattern for a skirt
- noun photographic print of plans or technical drawings etc.
- More ‘blueprint’ Meaning
- blueprinting Associated Words
- blueprinting Related Words
- noun something intended as a guide for making something else
-
teleprinter
- noun a character printer connected to a telegraph that operates like a typewriter
telex machine; teletype machine; teletypewriter; telex.
- More ‘teleprinter’ Meaning
- teleprinters Associated Words
- teleprinters Related Words
- noun a character printer connected to a telegraph that operates like a typewriter
-
blueprint
- noun something intended as a guide for making something else
pattern; design.- a blueprint for a house
- a pattern for a skirt
- noun photographic print of plans or technical drawings etc.
- More ‘blueprint’ Meaning
- blueprinted Associated Words
- blueprinted Related Words
- noun something intended as a guide for making something else
-
voiceprint
- noun biometric identification by electronically recording and graphically representing a person’s voice
- voiceprints are uniquely characteristic of individual speakers
- More ‘voiceprint’ Meaning
- voiceprints Associated Words
- voiceprints Related Words
- noun biometric identification by electronically recording and graphically representing a person’s voice
-
unprintable
- adjective unfit for print because morally or legally objectionable or offensive to good taste
- an unprintable epithet
- unprintable pictures
- More ‘unprintable’ Meaning
- unprintable Associated Words
- unprintable Related Words
- adjective unfit for print because morally or legally objectionable or offensive to good taste
-
imprint
- noun a distinctive influence
- English stills bears the imprint of the Norman invasion
- noun a concavity in a surface produced by pressing
impression; depression.- he left the impression of his fingers in the soft mud
- More ‘imprint’ Meaning
- imprinter Associated Words
- imprinter Related Words
- noun a distinctive influence
About Prefix and Suffix Words
This page lists all the words created by adding prefixes, suffixes to the word `print`. For each word, youwill notice a blue bar below the word. The longer the blue bar below a word, the more common/popular the word. Very short blue bars indicate rare usage.
While some of the words are direct derivations of the word `print`, some are not.
You can click on each word to see it’s meaning.
About Prefix and Suffix Words
This page lists all the words created by adding prefixes, suffixes to the word `print`. For each word, youwill notice a blue bar below the word. The longer the blue bar below a word, the more common/popular the word. Very short blue bars indicate rare usage.
While some of the words are direct derivations of the word `print`, some are not.
You can click on each word to see it’s meaning.
Skip to content
In Dan Gookin’s Word 2016 for Dummies (Wiley, 2016), he provides a good deal of helpful guidance for beginning Word users. One particularly helpful resource that may be of interest more broadly is his nicely condensed presentation of prefix keys for producing diacritical marks (pg. 256, reproduced below).
As the name suggests, the prefix key combination gets typed first, then the letter to which the diacritic should attach, and voila—the appropriate combined character is produced.
Tired of fighting with Word? Want to be done with frustrated hours fussing over how to get the formatting you need?
My new guide shows you how to bypass all of this so you can let Word work for you while you focus on your research.
For students in any graduate program, mastering the full range of available research tools is crucial for efficient and consistent productivity. Dr. Stark has mastered these tools—the most important of which is Microsoft Word…. Students eager to take their work to the next level would do well to follow Dr. Stark’s in-depth guidance.
Word styles can be tweaked to insert fixed characters before the text. Prefix anything in a certain style with your choice of characters or words. Suffixing, or adding after some text, is a lot harder.
Word’s prefix and suffix support is poor and very limited. This article shows what’s possible and workarounds for this strange omission.
Why prefix?
There are various situations where you might want to use a style to set words before a paragraph. For example, a simple Q & A with pairs of paragraphs like this:
With the preceding text in the style, it’s very easy to change the look. Use different words or abbreviation (Query, Ask, Prompt) or separator ( : – —…).
Yes, you could use Replace but that only works if the find text is only in that starting location, not anywhere else in the document.
Suffixes or text following isn’t supported by Word but you can fake it, almost. We’ll show some examples below.
- Adding … after an item
- ‘Read More’ or ‘click here’ text in links at end of excerpt.
- Whether a list (bullet or numbered) should have a fullstop/period at the end of each item. (this provokes some very heated opinions!)
Prefix/Suffix support would be great for special items like product codes, SKUs, code samples etc. With proper prefix/suffix support in character styles it would be possible to show those elements in a consistent and easily changeable way. (SKU1234) could become [SKU1234] {SKU1234} or just SKU1234 by just changing the style.
CSS prefix/suffix
Web designers know that prefix/suffix is easy with Cascading Style Sheets CSS used in most web sites. There are Pseudo-elements called :before and :after combined with the ‘content’ property that can add whatever you like as prefix or suffix.
ol li:before { content:"Question "; }
That CSS code adds the text ‘Question ’ to the start of each item in an numbered list.
If it’s possible and easy in a browser, surely it’s available in Microsoft Word? Sorry, not so much.
Prefix
There’s no direct support for prefixes in Word but it’s fairly easy to fake for paragraphs. In short, use multi-level numbering but without the numbers!
As you may know, Home | Paragraph | Multi-Level list can add text before numbers like Article, Heading, Section etc.
Make a new Multilevel list.
Number style for this level choose None.
- Number style for this level – type in the prefix text you want.
Answer could be a separate multilevel list style but it’s probably easier to make it the second level of the same list style. If you wish, change the Aligned and Text indent so it’s aligned with Question, instead of the default indenting.
That works for paragraphs but not for character styles where, arguably, prefix/suffix support is needed even more. There’s a workaround for that, which we’ll explain below for suffixes.
Suffix
Adding fixed suffix text is possible but a lot harder. Harder than it should be.
Here’s an example of where a style-based suffix would be useful. The label (Bold, Italic etc.) can have different suffixes depending on preference (space, colon, dash, em-dash).
Ideally the label text could have a Character Style with a suffix setup in the style. Since Microsoft hasn’t given us that, we have to look for workarounds.
If the suffix character or word is only in the suffix and nowhere else in the document, a simple Replace is enough.
But if the suffix is (or might be) in other parts of the document, a more complex Replace is necessary.
End of Paragraph only
One possibility is to search for the ending text plus the end of paragraph marker (^p in a find or replace). That ensures you only replace text at the end of a paragraph.
This example replaces ellipsis … with a colon but only if at the end of a paragraph.
Limit by style
Another way to limit a find/replace is by style.
For this to work, you need to apply a special style to the paragraphs or phrases that need a special suffix. Any replace can be limited to text just in that style. Choose the find and replace style using Format | Style.
This example only applies to text with the style ‘Code char’, the square closing bracket is replaced with a curly closing bracket. E.g. [Screen Cap] becomes [Screen Cap} .
VITAL! This assumes that the prefix/suffix character is ONLY used in those two positions, not in the main text formatted with that style.
That’s also a way to workaround prefix/suffix in a character style.
Adding text to character style
If there’s no prefix/suffix text already present, there’s a way to insert text before or after a character style.
Use Replace with one of the lesser used find settings: Find whole words only. Combine that with searching in a chosen style only.
Replace with uses another lesser known option: Find What Text ^& which inserts the result of the find into the replace box. If you want a prefix, add the text before e.g
Command:^&
For a suffix put it after:
^& —
If you prefer Wildcards / Regular Expressions, try this.
(<[A-Za-z]@{1,99})
Or
(<*>)
Finds whole words (letters only) or entire words in the chosen style only.
This works for single words only, as in our example above.
Finding multiple words takes more complex wildcards that find the word and extend to the start of the following text (in this case ‘Ctrl’).
Wish List
If Microsoft wanted to improve Word styles, they could start by looking at some of the features in modern CSS like pseudo elements :before :after :first-letter and :first-line. Add to that something not in CSS :first-para
Continue Learning about English Language Arts
What is the root word for misprint?
print. Mis is the prefix. If you can’t answer that…..you have
problems
What is the prefix of intolerant?
Prefix=IN
Does purpose have a prefix?
Yes, prefix does have a prefix. The prefix is pur-.
Does the word prefix contain a prefix?
«pre- » is the prefix of prefix
What is prefix for demi?
Demi has no prefix; it IS a prefix.
По умолчанию Microsoft Word поставляется со стилями заголовков по умолчанию (например, заголовок 1, заголовок 2, заголовок 3….).
Эти значения по умолчанию могут быть изменены в зависимости от необходимости. Например, я изменил заголовки по умолчанию, чтобы они выглядели так:
Итак, теперь у меня есть документ, который структурирован как:
1. Content
1.1 Content
1.2 Content
1.2.1 Content
2. Content
2.1 Content
2.1.1 Content
2.1.2 Content
------ section break -------
3. Content
3.1 Content
3.2 Content
3.3 Content
4. Content
------ section break -------
5. Content
5.1 Content
5.2 Content
5.3 Content
5.3.1 Content
Каждая из основных областей контента разделена на разделы. Итак, в целях этой иллюстрации, скажем, у меня есть 2 разбиения на разделы в этом документе, разделяющие 3 основных области содержимого.
Однако, что мне нужно сделать, это перезапустить нумерацию в начале каждого раздела и поставить собственный префикс перед этими номерами. Как это:
X1. Content
X1.1 Content
X1.2 Content
X1.2.1 Content
X2. Content
X2.1 Content
X2.1.1 Content
X2.1.2 Content
------ section break -------
XI1 Content
XI1.1 Content
XI1.2 Content
XI1.3 Content
XI2 Content
------ section break -------
XII1 Content
XII1.1 Content
XII1.2 Content
XII1.3 Content
XII1.3.1 Content
Я попытался сделать это с помощью простой последовательности команд «Перезапустить нумерацию» и «Установить значение нумерации», но если вы используете пронумерованные заголовки, он не позволит вам поставить перед ним буквенный префикс.
Допустим, у меня есть до трех уровней на раздел — x, xx, xxx — я думаю, что мне нужно создать 3 пользовательских стиля заголовков для каждого раздела, всего в этом примере 9 пользовательских стилей заголовков (если мой математика это правильно). Я надеялся, что есть более простой способ, чем это.
Какие-либо предложения?
Given an array of words, find all shortest unique prefixes to represent each word in the given array. Assume that no word is a prefix of another. Output the shortest unique prefixes in sorted order.
Input : {"zebra", "dog", "duck", "dove"} Output : z, dog, dov, du Explanation: dog => dog dove = dov duck = du z => zebra Input: {"geeksgeeks", "geeksquiz", "geeksforgeeks"} Output: geeksf, geeksg, geeksq
We have discussed a Trie based approach in the below post.
Find shortest unique prefix for every word in a given list | Set 1 (Using Trie)
In this post, a sorting based approach is discussed. On comparing the string with 2 other most similar strings in the array, we can find its shortest unique prefix. For example, if we sort the array {“zebra”, “dog”, “duck”, “dove”}, we get {“dog”, “dove”, “duck”, “zebra”}. The shortest unique prefix for the string “dove” can be found as:
Compare “dove” to “dog” –> unique prefix for dove is “dov”
Compare “dove” to “duck” –> unique prefix for dove is “do”
Now, the shortest unique prefix for “dove” is the one with greater length between “dov” and “do”. So, it is “dov”.
The shortest unique prefix for the first and last string can be found by comparing them with only 1 most similar neighbor on right and left, respectively.
We can sort the array of strings and keep on doing this for every string of the array.
Implementation:
C++
#include <bits/stdc++.h>
using
namespace
std;
vector<string> uniquePrefix(vector<string> &a)
{
int
size = a.size();
vector<string> res(size);
sort(a.begin(), a.end());
int
j = 0;
while
(j < min(a[0].length() - 1, a[1].length() - 1))
{
if
(a[0][j] == a[1][j])
j++;
else
break
;
}
int
ind = 0;
res[ind++] = a[0].substr(0, j + 1);
string temp_prefix = a[1].substr(0, j + 1);
for
(
int
i = 1; i < size - 1; i++)
{
j = 0;
while
(j < min(a[i].length() - 1, a[i + 1].length() - 1))
{
if
(a[i][j] == a[i + 1][j])
j++;
else
break
;
}
string new_prefix = a[i].substr(0, j + 1);
if
(temp_prefix.length() > new_prefix.length())
res[ind++] = temp_prefix;
else
res[ind++] = new_prefix;
temp_prefix = a[i + 1].substr(0, j + 1);
}
j = 0;
string sec_last = a[size - 2];
string last = a[size - 1];
while
(j < min(sec_last.length() - 1, last.length() - 1))
{
if
(sec_last[j] == last[j])
j++;
else
break
;
}
res[ind] = last.substr(0, j + 1);
return
res;
}
int
main()
{
vector<string> input = {
"zebra"
,
"dog"
,
"duck"
,
"dove"
};
vector<string> output = uniquePrefix(input);
cout <<
"The shortest unique prefixes in sorted order are : n"
;
for
(
auto
i : output)
cout << i <<
' '
;
return
0;
}
Java
import
java.io.*;
import
java.util.*;
class
GFG
{
public
String[] uniquePrefix(String[] a)
{
int
size = a.length;
String[] res =
new
String[size];
Arrays.sort(a);
int
j =
0
;
while
(j < Math.min(a[
0
].length()-
1
, a[
1
].length()-
1
))
{
if
(a[
0
].charAt(j)==a[
1
].charAt(j))
j++;
else
break
;
}
int
ind =
0
;
res[ind++] = a[
0
].substring(
0
, j+
1
);
String temp_prefix = a[
1
].substring(
0
, j+
1
);
for
(
int
i =
1
; i < size-
1
; i++)
{
j =
0
;
while
(j < Math.min( a[i].length()-
1
, a[i+
1
].length()-
1
))
{
if
(a[i].charAt(j) == a[i+
1
].charAt(j))
j++;
else
break
;
}
String new_prefix = a[i].substring(
0
, j+
1
);
if
(temp_prefix.length() > new_prefix.length() )
res[ind++] = temp_prefix;
else
res[ind++] = new_prefix;
temp_prefix = a[i+
1
].substring(
0
, j+
1
);
}
j =
0
;
String sec_last = a[size-
2
] ;
String last = a[size-
1
];
while
(j < Math.min( sec_last.length()-
1
, last.length()-
1
))
{
if
(sec_last.charAt(j) == last.charAt(j))
j++;
else
break
;
}
res[ind] = last.substring(
0
, j+
1
);
return
res;
}
public
static
void
main(String[] args)
{
GFG gfg =
new
GFG();
String[] input = {
"zebra"
,
"dog"
,
"duck"
,
"dove"
};
String[] output = gfg.uniquePrefix(input);
System.out.println(
"The shortest unique prefixes"
+
" in sorted order are :"
);
for
(
int
i=
0
; i < output.length; i++)
System.out.print( output[i] +
" "
);
}
}
Python3
def
uniquePrefix(a):
size
=
len
(a)
res
=
[
0
]
*
(size)
a
=
sorted
(a)
j
=
0
while
(j <
min
(
len
(a[
0
])
-
1
,
len
(a[
1
])
-
1
)):
if
(a[
0
][j]
=
=
a[
1
][j]):
j
+
=
1
else
:
break
ind
=
0
res[ind]
=
a[
0
][
0
:j
+
1
]
ind
+
=
1
temp_prefix
=
a[
1
][
0
:j
+
1
]
for
i
in
range
(
1
, size
-
1
):
j
=
0
while
(j <
min
(
len
(a[i])
-
1
,
len
(a[i
+
1
])
-
1
)):
if
(a[i][j]
=
=
a[i
+
1
][j]):
j
+
=
1
else
:
break
new_prefix
=
a[i][
0
:j
+
1
]
if
(
len
(temp_prefix) >
len
(new_prefix)):
res[ind]
=
temp_prefix
ind
+
=
1
else
:
res[ind]
=
new_prefix
ind
+
=
1
temp_prefix
=
a[i
+
1
][
0
:j
+
1
]
j
=
0
sec_last
=
a[size
-
2
]
last
=
a[size
-
1
]
while
(j <
min
(
len
(sec_last)
-
1
,
len
(last)
-
1
)):
if
(sec_last[j]
=
=
last[j]):
j
+
=
1
else
:
break
res[ind]
=
last[
0
:j
+
1
]
return
res
if
__name__
=
=
'__main__'
:
input
=
[
"zebra"
,
"dog"
,
"duck"
,
"dove"
]
output
=
uniquePrefix(
input
)
print
(
"The shortest unique prefixes "
+
"in sorted order are : "
)
for
i
in
output:
print
(i, end
=
" "
)
C#
using
System;
class
GFG
{
public
String[] uniquePrefix(String[] a)
{
int
size = a.Length;
String[] res =
new
String[size];
Array.Sort(a);
int
j = 0;
while
(j < Math.Min(a[0].Length - 1, a[1].Length - 1))
{
if
(a[0][j] == a[1][j])
j++;
else
break
;
}
int
ind = 0;
res[ind++] = a[0].Substring(0, j + 1);
String temp_prefix = a[1].Substring(0, j + 1);
for
(
int
i = 1; i < size - 1; i++)
{
j = 0;
while
(j < Math.Min( a[i].Length - 1, a[i + 1].Length - 1 ))
{
if
(a[i][j] == a[i + 1][j])
j++;
else
break
;
}
String new_prefix = a[i].Substring(0, j+1);
if
(temp_prefix.Length > new_prefix.Length )
res[ind++] = temp_prefix;
else
res[ind++] = new_prefix;
temp_prefix = a[i+1].Substring(0, j+1);
}
j = 0;
String sec_last = a[size-2] ;
String last = a[size-1];
while
(j < Math.Min( sec_last.Length-1, last.Length-1))
{
if
(sec_last[j] == last[j])
j++;
else
break
;
}
res[ind] = last.Substring(0, j+1);
return
res;
}
public
static
void
Main(String[] args)
{
GFG gfg =
new
GFG();
String[] input = {
"zebra"
,
"dog"
,
"duck"
,
"dove"
};
String[] output = gfg.uniquePrefix(input);
Console.WriteLine(
"The shortest unique prefixes"
+
" in sorted order are :"
);
for
(
int
i = 0; i < output.Length; i++)
Console.Write( output[i] +
" "
);
}
}
Javascript
<script>
function
uniquePrefix(a)
{
let size = a.length;
let res =
new
Array(size);
a.sort();
let j = 0;
while
(j < Math.min(a[0].length-1, a[1].length -1))
{
if
(a[0].charAt(j)==a[1].charAt(j))
j++;
else
break
;
}
let ind = 0;
res[ind++] = a[0].substring(0, j+1);
let temp_prefix = a[1].substring(0, j+1);
for
(let i = 1; i < size-1; i++)
{
j = 0;
while
(j < Math.min( a[i].length-1, a[i+1].length-1 ))
{
if
(a[i].charAt(j) == a[i+1].charAt(j))
j++;
else
break
;
}
let new_prefix = a[i].substring(0, j+1);
if
(temp_prefix.length > new_prefix.length )
res[ind++] = temp_prefix;
else
res[ind++] = new_prefix;
temp_prefix = a[i+1].substring(0, j+1);
}
j = 0;
let sec_last = a[size-2] ;
let last = a[size-1];
while
(j < Math.min( sec_last.length-1, last.length-1))
{
if
(sec_last.charAt(j) == last.charAt(j))
j++;
else
break
;
}
res[ind] = last.substring(0, j+1);
return
res;
}
let input = [
"zebra"
,
"dog"
,
"duck"
,
"dove"
];
let output = uniquePrefix(input);
document.write(
"The shortest unique prefixes"
+
" in sorted order are :"
+
"<br/>"
);
for
(let i=0; i < output.length; i++)
document.write( output[i] +
" "
);
</script>
Output
The shortest unique prefixes in sorted order are : dog dov du z
Another Python approach:
If we want to output the prefixes as the order of strings in the input array, we can store the string and its corresponding index in the hashmap. While adding the prefix to the result array, we can get the index of the corresponding string from the hashmap and add the prefix to that index.
Implementation:
C++
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using
namespace
std;
int
main() {
string a[] = {
"dogs"
,
"dove"
,
"duck"
,
"zebra"
};
vector<string> r;
int
j = 0;
while
(j < min(a[0].length(), a[1].length())) {
if
(a[0][j] == a[1][j]) {
j++;
}
else
{
break
;
}
}
r.push_back(a[0].substr(0, j+1));
string x = a[1].substr(0, j+1);
for
(
int
i = 1; i <
sizeof
(a) /
sizeof
(a[0]) - 1; i++) {
j = 0;
while
(j < min(a[i].length(), a[i+1].length())) {
if
(a[i][j] == a[i+1][j]) {
j++;
}
else
{
break
;
}
}
string y = a[i].substr(0, j+1);
if
(x.length() > y.length()) {
r.push_back(x);
}
else
{
r.push_back(y);
}
x = a[i+1].substr(0, j+1);
}
j = 0;
string l = a[
sizeof
(a)/
sizeof
(a[0])-2];
string k = a[
sizeof
(a)/
sizeof
(a[0])-1];
while
(j < min(l.length(), k.length())) {
if
(l[j] == k[j]) {
j++;
}
else
{
break
;
}
}
r.push_back(k.substr(0, j+1));
cout <<
"The shortest unique prefixes are: "
;
for
(string prefix : r) {
cout << prefix <<
" "
;
}
return
0;
}
Java
import
java.util.ArrayList;
import
java.util.List;
public
class
ShortestUniquePrefix {
public
static
void
main(String[] args) {
String[] a = {
"dogs"
,
"dove"
,
"duck"
,
"zebra"
};
List<String> r =
new
ArrayList<>();
int
j =
0
;
while
(j < Math.min(a[
0
].length(), a[
1
].length())) {
if
(a[
0
].charAt(j) == a[
1
].charAt(j)) {
j +=
1
;
}
else
{
break
;
}
}
r.add(a[
0
].substring(
0
, j +
1
));
String x = a[
1
].substring(
0
, j +
1
);
for
(
int
i =
1
; i < a.length -
1
; i++) {
j =
0
;
while
(j < Math.min(a[i].length(), a[i +
1
].length())) {
if
(a[i].charAt(j) == a[i +
1
].charAt(j)) {
j +=
1
;
}
else
{
break
;
}
}
String y = a[i].substring(
0
, j +
1
);
if
(x.length() > y.length()) {
r.add(x);
}
else
{
r.add(y);
}
x = a[i +
1
].substring(
0
, j +
1
);
}
j =
0
;
String l = a[a.length -
2
];
String k = a[a.length -
1
];
while
(j < Math.min(l.length(), k.length())) {
if
(l.charAt(j) == k.charAt(j)) {
j +=
1
;
}
else
{
break
;
}
}
r.add(k.substring(
0
, j +
1
));
System.out.println(
"The shortest unique prefixes are: "
);
for
(String prefix : r) {
System.out.print(prefix +
" "
);
}
}
}
Python3
a
=
[
'dogs'
,
'dove'
,
'duck'
,
'zebra'
]
r
=
[]
j
=
0
while
(j<
min
(
len
(a[
0
]),
len
(a[
1
]))):
if
(a[
0
][j]
=
=
a[
1
][j]):
j
+
=
1
else
:
break
i
=
0
r.append(a[
0
][
0
:j
+
1
])
x
=
a[
1
][
0
:j
+
1
]
for
i
in
range
(
1
,
len
(a)
-
1
):
j
=
0
while
(j<
min
(
len
(a[i]),
len
(a[i
+
1
]))):
if
a[i][j]
=
=
a[i
+
1
][j]:
j
+
=
1
else
:
break
y
=
a[i][
0
:j
+
1
]
if
(
len
(x)>
len
(y)):
r.append(x)
else
:
r.append(y)
x
=
a[i
+
1
][
0
:j
+
1
]
j
=
0
l
=
a[
len
(a)
-
2
]
k
=
a[
len
(a)
-
1
]
while
(j<
min
(
len
(l),
len
(k))):
if
( l[j]
=
=
k[j]):
j
+
=
1
else
:
break
r.append(k[
0
:j
+
1
])
print
(
"The shortest unique prefixes are :"
)
for
i
in
range
(
0
,
len
(r)):
print
(r[i],end
=
' '
)
Javascript
let a=[
'dogs'
,
'dove'
,
'duck'
,
'zebra'
];
let r=[];
let j=0;
while
(j<Math.min(a[0].length, a[1].length)){
if
(a[0][j]===a[1][j]){
j+=1;
}
else
{
break
;
}
}
r.push(a[0].substring(0, j+1));
let x=a[1].substring(0, j+1);
for
(let i=1; i<a.length-1; i++){
j=0;
while
(j<Math.min(a[i].length, a[i+1].length)){
if
(a[i][j]===a[i+1][j]){
j+=1;
}
else
{
break
;
}
}
let y=a[i].substring(0, j+1);
if
(x.length>y.length){
r.push(x);
}
else
{
r.push(y);
}
x=a[i+1].substring(0, j+1);
}
j=0;
let l=a[a.length-2];
let k=a[a.length-1];
while
(j<Math.min(l.length, k.length)){
if
(l[j]===k[j]){
j+=1;
}
else
{
break
;
}
}
r.push(k.substring(0, j+1));
console.log(
"The shortest unique prefixes are :"
);
for
(let i=0; i<r.length; i++){
process.stdout.write(r[i] +
' '
);
}
C#
using
System;
using
System.Collections.Generic;
public
class
ShortestUniquePrefix {
static
public
void
Main()
{
string
[] a = {
"dogs"
,
"dove"
,
"duck"
,
"zebra"
};
List<
string
> r =
new
List<
string
>();
int
j = 0;
while
(j < Math.Min(a[0].Length, a[1].Length)) {
if
(a[0][j] == a[1][j]) {
j += 1;
}
else
{
break
;
}
}
r.Add(a[0].Substring(0, j + 1));
string
x = a[1].Substring(0, j + 1);
for
(
int
i = 1; i < a.Length - 1; i++) {
j = 0;
while
(j < Math.Min(a[i].Length,
a[i + 1].Length)) {
if
(a[i][j] == a[i + 1][j]) {
j += 1;
}
else
{
break
;
}
}
string
y = a[i].Substring(0, j + 1);
if
(x.Length > y.Length) {
r.Add(x);
}
else
{
r.Add(y);
}
x = a[i + 1].Substring(0, j + 1);
}
j = 0;
string
l = a[a.Length - 2];
string
k = a[a.Length - 1];
while
(j < Math.Min(l.Length, k.Length)) {
if
(l[j] == k[j]) {
j += 1;
}
else
{
break
;
}
}
r.Add(k.Substring(0, j + 1));
Console.WriteLine(
"The shortest unique prefixes are: "
);
foreach
(
string
prefix
in
r)
{
Console.Write(prefix +
" "
);
}
}
}
Output
The shortest unique prefixes are : dog dov du z
For a more efficient solution, we can use Trie as discussed in this post.
This article is contributed by Saloni Baweja. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Sometimes you may need to customize Microsoft Word heading numbering and add some text as a prefix to the numbers. For example, you may need to change “1. Introduction” to “Chapter 1: Introduction” by adding the word “Chapter” as a prefix.
Here I assume that you have already added numbered multilevel heading styles to your document. If you want to learn word heading numbering, you may read “How to Create Numbered Multilevel Heading Styles in Microsoft Word“.
You may also read “How to Create Professional Reports with Microsoft Word“
- Place the cursor somewhere in the heading 1 title (Important: Make sure you’re using built-in heading styles in your document and added numbering to headings.)
- Go to; Home>Multilevel List (in the Paragraph group)> Define New Multilevel List…
- In the number format section of the “Define New Multilevel List” dialog box, enter your prefix (Ex. Chapter) in the text box below “Enter formatting for number:”. Do not delete the number.
- Click Ok
This change is applied to all the numbered heading 1 titles in the document. If you want to have more custom changes you can expand the “Define New Multilevel List” dialog box using More>> button.