AlgoLounge

String Comparison

easy

Note: Some systems may show output as 1 or 0, but they represent true or false. Your function should return a boolean.

Given two strings, determine if they are exactly identical. The comparison is case-sensitive and considers all characters including whitespace.

Examples

Example 1

Input:  s1 = "hello", s2 = "hello"
Output: true

Example 2

Input:  s1 = "Hello", s2 = "hello"
Output: false

Example 3

Input:  s1 = "", s2 = ""
Output: true

Constraints

  • Strings can be empty
  • Case-sensitive comparison
  • Whitespace matters
TypeScript
Loading editor…
List of test cases (10)
Case 1
s1 = "hello"
s2 = "hello"
Case 2
s1 = "Hello"
s2 = "hello"
Case 3
s1 = ""
s2 = ""
Case 4
s1 = "test "
s2 = "test"
Case 5
s1 = "abc"
s2 = "abc"
Case 6
s1 = "hello world"
s2 = "hello world"
Case 7
s1 = "Test"
s2 = "test"
Case 8
s1 = "a"
s2 = "a"
Case 9
s1 = " "
s2 = " "
Case 10
s1 = "123"
s2 = "123"