InterviewBit Academy is now Scaler!
InterviewBit Academy is now Scaler Academy!

Are they same - I

Given two string A and B with backspace character. Output 1 if both strings would end up to be same, 0 otherwise.


  1. You are Not allowed to use extra memory.
  2. “\B” denotes the backspace character.

Input Format:

    First argument of input contains a string A.
    Second argument of input contains a string B.

Output Format:

    return an integer 1 if strings would be same, 0 otherwise.


    1 <= |A| , |B| <= 1,000,000
    string consist of smaller case english alphabets and "\B".

For Example:

Input 1:
    A = "abc\Bbd\Be", B = "abbe\Be"
Output 1:
    both strings would end up to be "abbe".
Input 2:
    A="a\Bb", B="b\B"
Output 2:
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Are they same - I on Interview Code Editor
Sign Up
to access hints and editorial solutions for Are they same - I


Click here to start solving coding interview questions