package main
import (
"bufio"
"fmt"
"os"
)
func reverse(s string) string {
runes := []rune(s)
for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
runes[i], runes[j] = runes[j], runes[i]
}
return string(runes)
}
func main() {
input := bufio.NewReader(os.Stdin)
var total int
_, _ = fmt.Fscan(input, &total)
for t := 0; t < total; t += 1 {
var (
x string
y string
)
_, _ = fmt.Fscan(input, &x, &y)
x = reverse(x)
y = reverse(y)
first := 0
for i, c := range y {
if c == '1' {
first = i
break
}
}
ans := 0
for i, c := range x {
if c == '1' && i >= first {
ans = i - first
break
}
}
fmt.Println(ans)
}
}
A 题
给俩二进制,相加后逆序,字典序最小,一个贪心