atcoder#PANASONIC2020E. Three Substrings
Three Substrings
Score : points
Problem Statement
Snuke has a string . From this string, Anuke, Bnuke, and Cnuke obtained strings , , and , respectively, as follows:
- Choose a non-empty (contiguous) substring of (possibly itself). Then, replace some characters (possibly all or none) in it with
?
s.
For example, if is mississippi
, we can choose the substring ssissip
and replace its -st and -rd characters with ?
to obtain ?s?ssip
.
You are given the strings , , and . Find the minimum possible length of .
Constraints
- , , and consists of lowercase English letters and
?
s.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum possible length of .
a?c
der
cod
7
For example, could be atcoder
.
atcoder
atcoder
???????
7
, , and may not be distinct.