FastPrepFastPrep
Problem Brief

Convert Simple Password to Complex

INTERNOA
See Cisco online assessment and hiring insights

A company's IT department is faced with a dilemma that users keep using simple passwords such as "password", "abc123" etc.

You are tasked with a challenge to write an algorithm to identify the total minimum number of changes (insertions and deletions) of characters to convert these simple passwords to their more difficult versions.

Input

The first line of input consists of a string-currPassword, representing the current password. The second line consists of a string-newPassword, representing the new password.

Output

Print an integer representing the minimum number of updates required (character insertions and deletions) to convert the current password into the new password.

1Example 1

Input
currPassword = "password", newPassword = "pss$w#rd"
Output
4
Explanation

The current password is "password" and the new password is "pss$w#rd"; we need to delete 'a' and 'o' (2 operations) and insert '$' and '#' (2 operations) to convert the current password into the new password. So, the output is 4.

public int minUpdates(String currPassword, String newPassword) {
  // write your code here
}
Input

currPassword

"password"

newPassword

"pss$w#rd"

Output

4

Sign in to submit your solution.