#K9126. Common Characters Finder
Common Characters Finder
Common Characters Finder
Given two strings, your task is to find all unique characters that appear in both strings. The matching is case-insensitive, and the result should be output in lowercase in sorted order.
Formally, let \( s_1 \) and \( s_2 \) be two input strings. Define the set of common characters as follows:
\[ C = \{ c \mid c \in \text{toLower}(s_1) \text{ and } c \in \text{toLower}(s_2) \} \]You should output the characters in \( C \) as a single string with the characters in ascending order. If there are no common characters, output an empty line.
Example:
Input: abc cab</p>Output: abc
inputFormat
The input consists of two lines:
- The first line contains the string \( s_1 \).
- The second line contains the string \( s_2 \).
Both strings may include letters, numbers, spaces, and punctuation.
outputFormat
Output a single line containing a sorted string of unique lowercase characters that appear in both input strings. If there are no common characters, output an empty line.
## sampleabc
cab
abc
</p>