首页 > ACM题库 > HDU-杭电 > hdu 4295 4 substrings problem待解决[解题报告]C++
2015
05-23

hdu 4295 4 substrings problem待解决[解题报告]C++

4 substrings problem

问题描述 :

  One day you heard the following joke
    In America, you write strings.
    In Soviet Russia, String writes YOU!!
1
  And find that now string is writting you! So to get rid of it, you must solve the following problem:
  Given a string S and its four substring a,b,c, and d. In a configuration, you can place four substrings exactly one position it occurs in S (they may overlap), and characters covered by at least one such substring is called “covered”.
  You should solve for minimum and maximum possible number of covered characters in a configuration.
  You may assume that s contains only lowercase letters, and is of length less than 4096. However, lengths of a,b,c, and d would never exceed 64.
——————————————————————-
1An infamous Russian reversal

输入:

  There are several test cases.
  For each test case there are 5 lines, denoting S,a,b,c, and d, respectively.
  Please process until the EOF (End Of File).

输出:

  There are several test cases.
  For each test case there are 5 lines, denoting S,a,b,c, and d, respectively.
  Please process until the EOF (End Of File).

样例输入:

hello
he
l
l
o
abacaba
ab
ba
a
c

样例输出:

4 5
4 6