P26947 [AtCoder] Longest Non-Common Subsequence
NOI
题目描述

Problem Description

You are given two strings $ S $ and $ T $ consisting of lowercase English letters.
Take a subsequence $ S' $ of $ S $ and a subsequence $ T' $ of $ T $ such that $ |S'| = |T'|.
Find the maximum possible number of indices $ i $ $(1 \leq i \leq |S'|)$ where the $ i $-th character of $ S' $ differs from the $ i $-th character of $ T' $.

Input Format

The input is given from the standard input in the following format:

$ S $ $ T $

Output Format

Output the maximum number of indices $ i $ where the $ i $-th character of $ S' $ differs from the $ i $-th character of $ T' $.

Sample Input and Output

Sample Input #1

abc
aba

Sample Output #1

2

Sample Input #2

aaaaaa
a

Sample Output #2

0

Sample Input #3

abra
cadabra

Sample Output #3

4

Notes/Hints

Constraints

  • $ S $ and $ T $ are strings consisting of lowercase English letters.
  • $1 \leq |S|, |T| \leq 5000$

Sample Explanation 1

Taking the string $ S' $ as ab and $ T' $ as ba, the number of indices $ i $ $(1 \leq i \leq |S'|)$ where the $ i $-th character of $ S' $ differs from the $ i $-th character of $ T' $ is $ 2 $, which is the maximum value.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
abc aba
样例输出
2