Longest Uncommon Subsequence I Problem

Longest Uncommon Subsequence I Problem — ExecCode Easy DSA Practice

Solve the Longest Uncommon Subsequence I problem on ExecCode. Free online easy DSA practice in String. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given two strings a and b, return the length of the longest uncommon subsequence between a and b. Your task is to if no such uncommon subsequence exists, return -1 . An uncommon subsequence between two strings is a string that is a subsequence of exactly one of them.

Examples

Input {"a": "aba", "b": "cdc"}; Output 3. Input {"a": "aaa", "b": "bbb"}; Output 3

Constraints

1 <= a.length, b.length <= 100 a and b consist of lower-case English letters.

Practice Longest Uncommon Subsequence I free on ExecCode. Browse DSA problems, topic map, and placement guides.