WOOW String#12249

WOOW String (Editorial)

Problem Author:

Hasan Saleh (MathModel)

Prepared by:

Hasan Saleh (MathModel)

Edited by:

Hasan Saleh (MathModel)

Solution

Iterate through the string from index to n-1 , If s_i=s_{i+1} then print , otherwise .

Complexity .

for _ in range(int(input())):
   n=int(input())
   s=input()
   for i in range(n-1):
      if(s[i]==s[i+1]):print('1',end='')
      else:print('0',end='')
   print()