CJam,70 64字节
由于@Peter泰勒切割{"789":I}{"76:":I}?
到"789""76"?:I
"67":Iq:A{AI#:B){AB<7+A{BI,+}~>+s:A];}{"76"I={"789":I}{"76":I}?];}?}/A
"67":Iq:A{AI#:B){AB<7+A{BI,+}~>+s:A];}{"76"I="789""76"?:I];}?}/A
我知道这可能会做得更多,对您的帮助将不胜感激,但是坦率地说,我很高兴自己能找到答案。这是我第一次编写CJam。
说明:
"67":I e# Assign the value of 67 to I
q:A e# Read the input and assign to A
{ e# Opening brackets for loop
AI#:B) e# Get the index of I inside A and assign to B. The increment value by 1 to use for if condition (do not want to process if the index was -1)
{ e# Open brackets for true result of if statement
AB< e# Slice A to get everything before index B
7+ e# Append 7 to slice
A{BI,+}~> e# Slice A to get everything after index B plus the length of string I (this will remove I entirely)
+s:A e# Append both slices, convert to string, and assign back to A
]; e# Clear the stack
} e# Closing brackets for the if condition
{ e# Open brackets for false result of if statement
"76"I= e# Check if I is equal to 76
"789" e# If I is 76, make I 789
"76"?:I e# If I is not 76, make I 76
]; e# Clear the stack if I does not exist inside A
}? e# Closing brackets for false result of if statement
}/ e# Loop
A e# Output A