# Longest Sentence Where Every Character Pair Repeats $n$ times

BACKGROUND

This is essentially a combination of two puzzles:
Longest *Sentence* With Only Repeating Character Pairs (which has been shown to be infinite)
Longest sentence with each letter repeated n times (which maxed out at $n=16$)

## CHALLENGE

Form a grammatically correct sentence with $c$ alphabetic characters ([A-Za-z])in which every letter pair appears exactly $n$ times. Your score is $n\times c$. Maximize that score.

Clarifications: (The example below is invalid and is only intended to assist in clarification.)

• Words can not be repeated but variations of a word do not count as a repetition. This includes plurals, possessives, contractions, etc. so long as it does not violate other clarifications. Uni the Unicorn's eating the unicorn! and Bob's bobbing bobbed the bobber. are OK but Unicorns ate the unicorn's food. is not OK as it violates the second clarification.
• Words count as a repetition if they match when converted to all uppercase and any non-letters are removed. Different definitions, punctuation, or capitalization does not prevent it counting as a repetition. Buffalo buffalos buffalo bison. (Buffalo "city" and buffalo "bully" are counted as a repitition.)
• Any non-letter (spaces, hyphens, apostrophes, etc.) should be stripped prior to analysis. The result will be just a string of letters. UnitheUnicornseatingtheunicorns
• Capitalization does not matter. Convert them all to uppercase if that helps. UNITHEUNICORNSEATINGTHEUNICORNS

The "purest" answers will also meet these conditions: (not required to be valid but somewhat more impressive)

• Every word appears on Dictionary.com
• No proper nouns
• No acronyms or abbreviations

## CHECKING

Here are some check methods. I've written a verbose one in VBA. Corrections and submissions in other languages are most welcome.

VBA

Outputs the most common, highest value for $n$ along with a score and a list of any that do not match. (It's not golfed at all because I preferred accuracy and readability over compression.)
Example 1) Input: Alfalfa. Output: n = 2, c = 7, Score = 14
Example 2) Input: Alfalfac. Output: n = 2: AC(1)
Example 3) Input: Uni Unicorns. Output: n = 1: UN(2), NI(2)

Option Explicit
Function ValidateString(s As String) As String
Dim i As Long, j As Long, sTemp As String, v As String
Dim cValue As String, cCount As Long, cCountCount As Long
Dim nValue As Long, nCount As Long, nList As String

'Sanitize
s = UCase(s)
For i = 1 To Len(s)
Select Case Asc(Mid(s, i, 1))
Case 65 To 90:  sTemp = sTemp & Mid(s, i, 1)
End Select
Next
s = sTemp

'Find all n values
For i = 1 To Len(s) - 1
cValue = Mid(s, i, 2)
cCount = 0
For j = 1 To Len(s) - 1
If Mid(s, j, 2) = cValue Then cCount = cCount + 1
Next j
nList = nList & "|" & cCount & "|"
Next

'Find largest, most common n value
For i = 1 To Len(s) - 1
cValue = Mid(s, i, 2)
cCount = 0
For j = 1 To Len(s) - 1
If Mid(s, j, 2) = cValue Then cCount = cCount + 1
Next j
cCountCount = (Len(nList) - Len(Replace(nList, "|" & cCount & "|", ""))) / (2 + Len(cCount))
If cCountCount > nCount Then nValue = cCount: nCount = cCountCount
If cCountCount = nCount And cCount > nValue Then nValue = cCount
Next

'List any that don't match
sTemp = ""
For i = 1 To Len(s) - 1
cValue = Mid(s, i, 2)
cCount = 0
For j = 1 To Len(s) - 1
If Mid(s, j, 2) = cValue Then cCount = cCount + 1
Next j
cCountCount = (Len(nList) - Len(Replace(nList, "|" & cCount & "|", ""))) / (2 + Len(cCount))
If cCountCount <> nCount And InStr(1, sTemp, cValue) = 0 Then sTemp = sTemp & cValue & " (" & cCount & "), "
Next
v = "n = " & nValue
If sTemp = "" Then v = v & ", c = " & Len(s) & ", Score = " & nValue * Len(s)
If sTemp <> "" Then v = v & ": " & Left(sTemp, Len(sTemp) - 2)
ValidateString = v
End Function

• Just a suggestion to puzzlers, pay very close attention to letter pairs that cross words (like 'ea' in 'the apple'). That was what tripped up a lot of the answers in the previous letter pair puzzle. – VictorHenry Jul 8 '15 at 15:29
• Sometimes the code doesn't return the list of unmatching digraphs. When I input "tomato", it returns "n=2", and when I input "mad madam mimi" it returns "n=2". – mmking Jul 8 '15 at 16:23
• @mmking When I put in "tomato" I get n = 1: TO(2). For "mad madam mimi" I get n = 2: DM(1), DA(1), AM(1), MM(1), IM(1). Curiouser and curiouser... – Engineer Toast Jul 8 '15 at 16:34
• That's weird. I put in in a vb.net console application on VS 2013 to run it, but I don't think there should be a difference. – mmking Jul 8 '15 at 16:40
• @mmking I'm running it in VBA within Excel. I'm not sure of the differences between VB and VBA. It sounds like it's returning as soon as ValidateString has a value. I'll setup another temp value and we can see if that helps. – Engineer Toast Jul 8 '15 at 16:42

## n = 8, c = 17, Score = 136

Rather than trying to maximize c, I am instead attempting to maximize n.

To that end:

Bobobo-bo Bo-bobo, bob!

This is an imperative statement, commanding the main character from this anime to commence attempting to extract apples from a bucket of water using only his teeth.

8 pairs * 17 characters = 136

I feel like one could torture a few more 'bo's in there, but I think this is fine for what is essentially a joke answer. =P

• I finally gave the tick for the highest score with a grammatically correct sentence. – Engineer Toast Jul 16 '15 at 19:18

## n = 2, c = 19, Score = 38

OK, here's one to get the ball rolling:

She's going to put her money on the old sailors:

SHE'LL BACK SHELLBACKS.

• It's valid so far as I can tell. It's in the familiar format [string][string][left(string,1)], which makes sense. I'm going to switch the score to be $n\times c$ where $c$ is the alpha characters in the sentence. – Engineer Toast Jul 8 '15 at 16:35

## n = 3, c = 13, Score = 39

A grammatically correct, but absolutely nonsense sentence.

Seats eat sea TS.

The explanation

Chairs consume top secrets of the sea. (To clarify, Dictionary.com lists the definition of TS as an abbreviation.)

• It's an expansion on the format: [string][string][string][left(string,1)]. I'm beginning to suspect they might all be that way. I hope not. – Engineer Toast Jul 8 '15 at 16:47

## n = 3, c = 19, Score = 57

If abbreviations are okay the:

Meaning:

• The sadder SA of the Adder's adder. doesn't seem like a valid grammatical construct. This is merely the subject, without a predicate. – CodeNewbie Jul 8 '15 at 17:21

## n = $\infty$: OB($\infty-1$)      (Invalid per clarification 1)

Without rules the hilarious near answer is:

Buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo ... on to infinity as there are no two'fer character pairs in buffalo so each pair gets repeated n times where n is the number of words. there is punctuation to deal with, but buffalo infinitum is a sentence.

• I believe that 'OB' repeats one fewer times than the rest of the letter pairs. – Bailey M Jul 8 '15 at 16:17
• And the OP said that you can't use the same word more than once. – mmking Jul 8 '15 at 16:18
• Excellent point, did not read the instructions closely, now if only B was a stand alone word that grammatically fit... – Going hamateur Jul 8 '15 at 16:18

## n = 7, c = 29, score = 203

Inspired by my first answer, here's another with a better value of n and much better score. Be warned, you are about to reveal yet another nonsensical sentence that stays on the right side of the grammar line...

Seats eat sea TS, eats, Ea, TSE at SE ATS.

The explanation

Chairs consume top secrets of the sea, food, the Akkadian god of wisdom, the Toronto Stock Exchange (sorry Canada) at the South Eastern outpost of the Auxiliary Territorial Service.

• I believe according to clarification #2, "seats" and "seat's" are counted as repeated words. – VictorHenry Jul 8 '15 at 17:07
• @VictorHenry: Not quite. The punctuation doesn't vary it as different proper nouns, because the second use of seat's is of the possessive form. This is valid according to clarification #1. – CodeNewbie Jul 8 '15 at 17:12
• Oh yes, I see. I think, actually, the clarifications directly contradict each other in this case. "Words count as a repetition if they match when converted to all uppercase and any non-letters are removed" is a direct contradiction of the possessives and contractions rule from the first clarification. – VictorHenry Jul 8 '15 at 17:22
• @VictorHenry They did contradict. I have revised it to remove it, I hope. – Engineer Toast Jul 8 '15 at 18:59
• I would argue that you need an and in that list o' yours. – Engineer Toast Jul 16 '15 at 19:18