To run, simply run compile main.java
using javac main.java
and then run class file with two command line argument.
java main 's1' 's2'
. It is mandatory that both command line arguments must be passed in a '' single quote.
Each character in s1 must be mapped with s2
. This means s2 can't have less character than s1. s2 must have more than or equal to chars in s1.
Input strings s1 and s2 may contain whitespaces which would be considered as a character.
- s1 = 'abc' s2 = 'bcd' ---> true
- s1 = 'foo' s2 = 'bar' ---> false
- s1 = 'bar' s2 = 'foo' ---> true
- s1 = '1111' s2 = '$$$$' ---> true
- s1 = 'aad' s2 = 'cbc' ---> true
- s1 = 'aazqdddd' s2 = 'zzzzqqad' ---> true
- s1 = 'aazqdddd' s2 = '$$$$++{}' ---> true
- s1 = 'a ad' s2 = 'afa ' ---> false (observe whitespace, it can't be mapped to anything in s2)
- s1 = 'aa' s2 = 'f' ---> false (second 'a' in s1 can't be mapped to any character in s2)