Game of Strings

4.2

5 votes
Problem

Harsh and Akshara are playing the Game of Strings. This game is a simple one and is played as a team. Both the players of a team will be given a string respectively. At the end of this game, every team is required find out the length of the longest string S such that the strings given to each of the team members is a subsequence of S and S contains no vowels. Help Harsh and Akshara in finding out the required length.

Input:
Input consists of a single line containing two space separated strings.

Output:
The length of the longest string that satisfy the given conditions.

Constraints:
1 ≤ length of string ≤ 5000

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

The required string is "ng".

Editor Image

?