Expenditure Reduction
题号:NC243737
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 1024 M,其他语言2048 M
64bit IO Format: %lld

题目描述

输入描述:

见 PDF 题面

输出描述:

见 PDF 题面
示例1

输入

复制
4
114514 15
shanghaicpc ac
aaabbbaaabbbccc abc
howdeliciousandfreshitis oishii

输出

复制
145
aic
abbbc
owdeliciousandfreshiti