String processor

Report a typo

Write a program that emulates a string processor. It reads two strings and an operator and outputs the result.

There are three possible operations:

  • equals returns true if these strings are equals, otherwise false (s1==s2);
  • plus appends the second line to the first line (s1+s2);
  • endsWith returns true if the first string ends with the second string, otherwise false (s1.endsWith(s2)).

Output the result as a string. If the operation is unknown, print Unknown operation without quotes.

You can use the endsWith(suffix) string function to find whether the string ends with a specified string.

Sample Input 1:

abc
equals
cde

Sample Output 1:

false

Sample Input 2:

abbc
plus
bb

Sample Output 2:

abbcbb

Sample Input 3:

abbc
endsWith
bc

Sample Output 3:

true
Write a program in Kotlin
fun main() {
// write your code here
}
___

Create a free account to access the full topic