package main

import (
	"fmt"
	"math"
)

func main() {

	var a, b string
	fmt.Scanf("%s\n%s", &a, &b)

	if a == b {
		fmt.Println(-1)
	} else {
		fmt.Printf("%d\n", int(math.Max(float64(len(a)), float64(len(b)))))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.goC"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var a, b string
	for I(&a, &b) == nil {
		solve(a, b)
	}
}

func solve(a, b string) {
	if a == b {
		O("-1\n")
	} else {
		O(max(len(a), len(b)), "\n")
	}
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"regexp"
)

func main() {
	ab := [2]string{}

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)
	for i := 0; i < 2; i++ {
		if s, err := reader.ReadString('\n'); err != nil {
			if err == io.EOF {
				break
			} else {
				return
			}
		} else {
			ab[i] = re.ReplaceAllString(s, "")
		}
	}

	if len(ab[0]) > len(ab[1]) {
		fmt.Println(len(ab[0]))
	} else if len(ab[0]) < len(ab[1]) {
		fmt.Println(len(ab[1]))
	} else {
		if ab[0] == ab[1] {
			fmt.Println(-1)
		} else {
			fmt.Println(len(ab[0]))
		}
	}
}

package main

import "fmt"

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var a, b string
	fmt.Scan(&a)
	fmt.Scan(&b)
	if a == b {
		fmt.Println(-1)
		return
	}
	fmt.Println(max(len(a), len(b)))
}

/*
few testcases

	abcd
	defgh

*/

package main
import (
	"fmt"
)

func max(x, y int) int {
    if x > y {
        return x
    }
    return y
}
func main()  {
	var x, y string
	fmt.Scan(&x)
	fmt.Scan(&y)

	if x == y {
		fmt.Println("-1")
	}else{
		fmt.Println(max(len(x), len(y)))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	a := readString()
	b := readString()
	if len(a) > len(b) {
		a, b = b, a
	}
	if len(a) != len(b) {
		fmt.Println(len(b))
		return
	}
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			fmt.Println(len(b))
			return
		}
	}
	fmt.Println(-1)
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF766A(in io.Reader, out io.Writer) {
	var s, t string
	if Fscan(bufio.NewReader(in), &s, &t); s == t {
		Fprint(out, -1)
	} else if len(s) > len(t) {
		Fprint(out, len(s))
	} else {
		Fprint(out, len(t))
	}
}

func main() { CF766A(os.Stdin, os.Stdout) }

package main

import (
	"bufio"
	"fmt"
	"os"
)

func readString(reader *bufio.Reader) string {
	var buf []byte
	for {
		str, prefix, err := reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buf = append(buf, str...)
		if !prefix {
			return string(buf)
		}
	}
}

func main() {
	input := bufio.NewReader(os.Stdin)
	a, b := readString(input), readString(input)
	if a == b {
		fmt.Println("-1")
	} else {
		ans := len(a)
		if len(b) > ans {
			ans = len(b)
		}
		fmt.Println(ans)
	}
}

package main

import "fmt"

func max(a, b int) int {
    if a > b {
        return a
    }
    return b
}

func main() {
    var s1, s2 string
    fmt.Scan(&s1)
    fmt.Scan(&s2)
    if s1 == s2 {
        fmt.Print(-1)
    } else {
        fmt.Print(max(len(s1), len(s2)))
    }
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var firstString, secondString string
	var firstLen, secondLen int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &firstString)
	fmt.Fscan(reader, &secondString)
	firstLen = len(firstString)
	secondLen = len(secondString)
	if firstLen > secondLen {
		fmt.Println(firstLen)
	} else if firstLen < secondLen {
		fmt.Println(secondLen)
	} else {
		for index := 0; index < firstLen; index++ {
			if firstString[index] != secondString[index] {
				fmt.Println(firstLen)
				return
			}
		}
		fmt.Println(-1)
	}

}

package main

import (
    "fmt"
)

func main() {
    var a, b string
    fmt.Scanf("%s\n%s", &a, &b)
    if len(a) == len(b) && a == b {
        fmt.Println(-1)
    } else {
        longer := len(a)
        if len(b) > longer {
            longer = len(b)
        }
        fmt.Println(longer)
    }
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

func Solve(io *FastIO) {
	A := io.NextLine()
	B := io.NextLine()

	if A == B {
		io.Println(-1)
	} else {
		io.Println(Max(len(A), len(B)))
	}
}

func Max(args ...int) int {
	max := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] > max {
			max = args[i]
		}
	}
	return max
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
		case 0, '\n', '\r':
			return true
		default:
			return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Solve(&io)
	io.FlushOutput()
}

package main

import (
	"strconv"
	"bufio"
	"os"
	"fmt"
)

func main() {
	sc := NewScanner()

	A := sc.NextLine()
	B := sc.NextLine()

	if A == B {
		fmt.Println(-1)
	} else {
		fmt.Println(max(len(A),len(B)))
	}

}

func max(a int, b int) int {
	if a < b {
		return b
	}
	return a
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.goC"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var a, b string
	for I(&a, &b) == nil {
		solve(a, b)
	}
}

func solve(a, b string) {
	h := make(map[uint64]int)
	for i := 0; i < len(a); i++ {
		for j := i; j < len(a); j++ {
			h[hash(a[i:j])] = j - i + 1
		}
	}
	ans := 0
	for i := 0; i < len(b); i++ {
		for j := i; j < len(b); j++ {
			if _, exists := h[hash(b[i:j])]; !exists {
				ans = max(ans, j-i+1)
			}
		}
	}
	if ans == 0 {
		ans--
	}
	O(ans, "\n")
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func hash(s string) uint64 {
	h := A
	for i := 0; i < len(s); i++ {
		h ^= pow(i+5) * uint64(s[i]+113)
	}
	return h
}

var A uint64 = 11111111111111111011
var pp [2000020]uint64

func pow(a int) uint64 {
	if a == 1 {
		return uint64(1117)
	} else if a == 0 {
		return 1
	} else if pp[a] == 0 {
		pp[a] = (uint64(1117) * pow(a-1)) % A
	}
	return pp[a]
}

package main

import (
	"fmt"
	"strings"
)

func main() {

	var a, b string
	fmt.Scanf("%s\n%s", &a, &b)

	if strings.Contains(a, b) {
		fmt.Println(-1)
	} else {
		fmt.Println(len(b))
	}
}

package main

import (
	"fmt"
	"math"
	"strings"
)

func main() {

	var a, b string
	fmt.Scanf("%s\n%s", &a, &b)

	if strings.Contains(a, b) {
		fmt.Println(-1)
	} else {
		fmt.Printf("%d\n", int(math.Max(float64(len(a)), float64(len(b)))))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	a := readString()
	b := readString()
	if len(a) > len(b) {
		a, b = b, a
	}
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			fmt.Println(len(b))
			return
		}
	}
	fmt.Println(-1)
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	a := readString()
	b := readString()
	if len(a) > len(b) {
		a, b = b, a
	}
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			fmt.Println(b)
			return
		}
	}
	fmt.Println(-1)
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

import "fmt"

func min(a, b int) int {
    if a < b {
        return a
    }
    return b
}

func main() {
    var s1, s2 string
    fmt.Scan(&s1)
    fmt.Scan(&s2)
    if s1 == s2 {
        fmt.Print(-1)
    } else {
        fmt.Print(min(len(s1), len(s2)))
    }
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var firstString, secondString string
	var prevChar, firstSubSeq, secondSubSeq int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &firstString)
	fmt.Fscan(reader, &secondString)
	prevChar = int(firstString[0])
	firstSubSeq = 1
	for index := 1; index < len(firstString); index++ {
		if prevChar < int(firstString[index]) {
			firstSubSeq++
		} else {
			firstSubSeq = 0
		}
	}
	secondSubSeq = 1
	for index := 1; index < len(secondString); index++ {
		if prevChar < int(secondString[index]) {
			secondSubSeq++
		} else {
			secondSubSeq = 0
		}
	}
	if firstSubSeq > secondSubSeq {
		fmt.Println(firstSubSeq)
	} else if firstSubSeq < secondSubSeq {
		fmt.Println(secondSubSeq)
	} else {
		fmt.Println(-1)
	}
}

package main

import (
	"strconv"
	"bufio"
	"os"
	"fmt"
)

func main() {
	sc := NewScanner()

	A := sc.NextLine()
	B := sc.NextLine()
	mpA := map[byte]bool{}
	mpB := map[byte]bool{}

	commonCount := 0
	for _, v := range A {
		mpA[byte(v)] = true
	}
	for _, v := range B {
		mpB[byte(v)] = true
	}

	for k, _ := range mpA {
		if _, ok := mpB[byte(k)]; ok {
			commonCount++
		}
	}

	v := max(len(mpA), len(mpB)) - commonCount
	if v > 0 {
		fmt.Println(v)
	} else {
		fmt.Println(-1)
	}

}
func max(a int, b int) int {
	if a < b {
		return b
	}
	return a
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

import (
	"strconv"
	"bufio"
	"os"
	"fmt"
)

func main() {
	sc := NewScanner()

	A := sc.NextLine()
	B := sc.NextLine()
	mpA := map[byte]bool{}
	mpB := map[byte]bool{}

	for _, v := range A {
		mpA[byte(v)] = true
	}
	for _, v := range B {
		mpB[byte(v)] = true
	}

	if len(mpA) == 1 && len(mpB) == 1 {
		v := min(len(A), len(B))
		if v == 1 {
			fmt.Println(-1)
			return
		}
		fmt.Println(v - 1)
		return
	}
	C := A
	D := B
	if len(A) < len(B) {
		C = B
		D = A
	}
	j := 0

	for i := 0; i < len(C); i++ {
		if C[i] == D[j] {
			j++
		}
	}
	if j == len(D) {
		fmt.Println(len(C) - 1)
	} else {
		fmt.Println(len(C))
	}

}
func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a int, b int) int {
	if a < b {
		return b
	}
	return a
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	for n > 0 {
		n--
		arr := make([]int, 5)
		for i := 0; i < 5; i++ {
			fmt.Scan(&arr[i])
		}
		if arr[0]+arr[1]+arr[2] < arr[3]+arr[4] {
			fmt.Println("NO")
		} else if arr[0]+arr[2] < arr[3] || arr[1]+arr[2] < arr[4] {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a, b, c, x, y int
		fmt.Scan(&a)
		fmt.Scan(&b)
		fmt.Scan(&c)
		fmt.Scan(&x)
		fmt.Scan(&y)

		if x >= a {
			x -= a
			if c < x {
				fmt.Println("NO")
				continue
			} else {
				c -= x
			}
		}

		if y >= b {
			y -= b
			if c < y {
				fmt.Println("NO")
			} else {
				fmt.Println("YES")
			}
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type CF1675A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1675A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1675A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1675A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1675A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1675A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1675A
Date: 9/05/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1675/A
Problem: CF1675A
**/
func (in *CF1675A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		a, b, c, x, y := in.NextInt(), in.NextInt(), in.NextInt(), in.NextInt(), in.NextInt()

		if a >= x {
			a -= x
			a = 0
			x = 0
		} else {
			x-= a
			a = 0
			if x <= c {
				c -= x
				x = 0
			}
		}

		if b >= y {
			a -= y
			b = 0
			y = 0
		} else {
			y-= b
			b = 0
			if y <= c {
				c -= y
				y = 0
			}

		}

		if x == 0 && y == 0{
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}

	}

}

func NewCF1675A(r *bufio.Reader) *CF1675A {
	return &CF1675A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1675A(bufio.NewReader(os.Stdin)).Run()
}

package main

import (
	"fmt"
)

func main() {
	var ts int
	fmt.Scanln(&ts)

	for i := 0; i < ts; i++ {
		var a, b, c, x, y int
		fmt.Scanf("%d %d %d %d %d\n", &a, &b, &c, &x, &y)

		ma := x - a
		if ma < 0 {
			ma = 0
		}
		mb := y - b
		if mb < 0 {
			mb = 0
		}

		if c >= ma+mb {
			fmt.Println("yes")
		} else {
			fmt.Println("no")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

//goland:noinspection GoUnusedFunction
func min(a int, nums ...int) int {
	min := a

	for _, num := range nums {
		if num < min {
			min = num
		}
	}
	return min
}

//goland:noinspection GoUnusedFunction
func max(a int, nums ...int) int {
	max := a

	for _, num := range nums {
		if num > max {
			max = num
		}
	}
	return max
}

//goland:noinspection GoUnusedFunction
func FprintlnArr(w io.Writer, arr []int) {
	for _, val := range arr {
		fmt.Fprint(w, val, " ")
	}
	fmt.Fprintln(w)
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var a, b, c, x, y int
		fmt.Fscan(in, &a, &b, &c, &x, &y)

		if max(x-a, 0)+max(y-b, 0) <= c {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < t; i++ {
		scanner.Scan()
		sl := strings.Split(scanner.Text(), " ")
		a, _ := strconv.Atoi(sl[0])
		b, _ := strconv.Atoi(sl[1])
		c, _ := strconv.Atoi(sl[2])
		x, _ := strconv.Atoi(sl[3])
		y, _ := strconv.Atoi(sl[4])
		xa := 0
		if x > a {
			xa = x - a
		}
		yb := 0
		if y > b {
			yb = y - b
		}
		if a >= x && b >= y {
			fmt.Println("YES")
		} else if xa+yb <= c {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)

	for i:=0;i<t;i++{ // take inputs
		list:= make([]int,5)
		for j:=0;j<5;j++{
			fmt.Fscan(in,&list[j])
		}
		if list[3] <= list[0] && list[4] <= list[1] { // check if already surplus
			fmt.Fprintln(out,"YES")
		} else {
			if (list[3]-list[0]) < 0 { // check if deficit
				list[2]-= 0
			} else {
				list[2]-= (list[3]-list[0]) // deduct from universal
			}
			if list[2] >= 0 { // check if deficit
				if list[4]-list[1] > list[2] { // if cat food exceeds reserve
					fmt.Fprintln(out,"NO")
				} else {
					fmt.Fprintln(out,"YES")
				}
			} else {
				fmt.Fprintln(out,"NO")
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in = bufio.NewReader(os.Stdin)
var tc = 1
var DEBUG = os.Getenv("DEBUG") != ""

func solve() {
	var a, b, c, x, y int
	scan(&a, &b, &c, &x, &y)
	x -= a
	y -= b
	x = max(x, 0)
	y = max(y, 0)
	if x == 0 && y == 0 {
		printf("YES\n")
		return
	}
	printf("%s\n", ys(x+y <= c))
}

func main() {
	var T int
	scan(&T)
	for ; T > 0; T-- {
		solve()
		tc++
	}
}

func ys(b bool) string      { return map[bool]string{true: "YES", false: "NO"}[b] }
func scan(a ...interface{}) { fmt.Fscan(in, a...) }
func printf(format string, a ...interface{}) {
	if DEBUG {
		format = fmt.Sprintf("Test #%d: %s", tc, format)
	}
	fmt.Printf(format, a...)
}

func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var a, b, c, x, y int
		fmt.Fscan(in, &a, &b, &c, &x, &y)
		x -= min(x, a)
		y -= min(y, b)
		if c >= x+y {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	// "math"
)

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func scan(a ...interface{}) {
	fmt.Fscan(in, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(out, f, a...)
}
func solve() {
	var a, b, c, x, y int
	scan(&a, &b, &c, &x, &y)
	if a+b+c >= x+y && a+c >= x && b+c >= y {
		printf("YES\n")
	} else {
		printf("NO\n")
	}
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
var wrtr = bufio.NewWriterSize(os.Stdout, 10_000_000)
var rdr = bufio.NewScanner(os.Stdin)
func gs() string  { rdr.Scan(); return rdr.Text() }
func gi() int     { i,e := strconv.Atoi(gs()); if e != nil {panic(e)}; return i }
func min(a,b int) int { if a > b { return b }; return a }
func main() {
	//f1, _ := os.Create("cpu.prof"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()
	defer wrtr.Flush()
	infn := ""; if infn == "" && len(os.Args) > 1 {	infn = os.Args[1] }
	if infn != "" {	f, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }
	rdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)
	// PROGRAM STARTS HERE
	T := gi()
	for tt:=1;tt<=T;tt++ {
		a,b,c,x,y := gi(),gi(),gi(),gi(),gi()
		a = min(a,x); b = min(b,y)
		ans := "NO"; if a+b+c >= x+y { ans = "YES" }
		fmt.Fprintln(wrtr,ans)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var wr = bufio.NewWriter(os.Stdout)
var rd = bufio.NewScanner(os.Stdin)

func nextInt() int {
	rd.Scan()
	if n, err := strconv.Atoi(rd.Text()); err == nil {
		return n
	}
	return 0
}
func Max(a,b int)int{
	if a>b {
		return a
	}else{
		return b
	}
}
func main() {
	defer wr.Flush()
	rd.Buffer(make([]byte, 0), 1000000009)
	rd.Split(bufio.ScanWords)
	T := nextInt()
	for Case := 0; Case < T; Case++ {
		solve()
	}
}
func solve() {
	a, b, c, x, y := nextInt(), nextInt(), nextInt(), nextInt(), nextInt()
	if Max(x-a,0)+Max(y-b,0) <= c {
		fmt.Fprint(wr, "YES\n")
	} else {
		fmt.Fprint(wr, "NO\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	MOD2 = 998244353
	MOD1 = 1000000007
)

var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	defer wr.Flush()
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	t := nextInt()
	for t > 0 {
		solve()
		t--
	}
}

func solve() {
	a := nextInt()
	b := nextInt()
	c := nextInt()
	x := nextInt()
	y := nextInt()

	x -= a
	y -= b
	if x > 0 {
		c -= x
	}
	if c < 0 {
		println("NO")
		return
	}

	if y > 0 {
		c -= y
	}

	if c < 0 {
		println("NO")
	} else {
		println("YES")
	}
}

func println(a ...interface{}) {
	fmt.Fprintln(wr, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(wr, a...)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, e := strconv.Atoi(next())
	if e != nil {
		panic(e)
	}
	return i
}

func nextFloat() float64 {
	i, e := strconv.ParseFloat(next(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextInts(n int) *[]int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return &ret
}

func getFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var a, b, c, x, y int
		fmt.Fscan(in, &a, &b, &c, &x, &y)

		x = max(0, x-a)
		y = max(0, y-b)

		if x+y <= c {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

import (
	"fmt"
	"bufio"
	"strings"
	"strconv"
	"os"
)

func main() {
	var (
		t int
	)

	reader := bufio.NewReader(os.Stdin)
	fmt.Scanf("%d\n", &t)

	for t > 0 {
		t--

		text, _ := reader.ReadString('\n')
		ninps := strings.Fields(text)
		a, _ := strconv.Atoi(ninps[0])
		b, _ := strconv.Atoi(ninps[1])
		c, _ := strconv.Atoi(ninps[2])
                x, _ := strconv.Atoi(ninps[3])
		y, _ := strconv.Atoi(ninps[4])

		if a+c >= x {
		        if a < x && (x-a) <= c {
		        	c -= (x - a)
			}
			if b + c >= y {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"bufio"
	. "fmt"
	"os"
)

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var n int
	Fscan(r, &n)
	t := 0
	var a, b, c, x, y int
	for t < n{
		t++
		Fscan(r, &a, &b, &c, &x, &y)
		a -= x
		b -= y
		if a < 0{
			c += a
		}
		if b < 0{
			c += b
		}
		if c >= 0{
			Fprintln(w, "YES")
		}else{
			Fprintln(w, "NO")
		}
	}

}

package main

import (
	"bufio"
	. "fmt"
	"os"
)

func main_div3_787_A() {
	_in, _out := os.Stdin, os.Stdout
	in, out := bufio.NewReader(_in), bufio.NewWriter(_out)
	defer out.Flush()
	var cas int = 1
	Fscan(in, &cas)
	var sol func()
	// Coding...
	sol = func() {
		var a, b, c, x, y int
		Fscan(in, &a, &b, &c, &x, &y)
		if a > x {
			a = x

		}
		if b > y {
			b = y
		}
		if a+b+c >= x+y {
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}
	for i := 0; i < cas; i++ {
		sol()
	}
}

func main() {
	main_div3_787_A()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func slove() {
	defer w.Flush()
	var a, b, c, x, y int
	fmt.Fscan(r, &a, &b, &c)
	fmt.Fscan(r, &x, &y)
	x -= a
	y -= b
	if max(x, 0) + max(y, 0) > c {
		fmt.Fprintln(w, "No")
	} else {
		fmt.Fprintln(w, "Yes")
	}
}

func max(a, b int) int {if a > b {return a} else {return b}}

func main() {
	var n int
	fmt.Fscan(r, &n)
	for i:=1;i<=n;i++ {
		slove()
	}
}

package main

import (
	"bufio"
	. "fmt"
	"os"
)

type Int int64

const (
	INF = 3e5 + 10
	L0  = Int(0)
	L1  = Int(1)
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var t int
	Fscan(in, &t)

	for tt := 0; tt < t; tt++ {
		var a, b, c, x, y Int
		Fscan(in, &a, &b, &c, &x, &y)

		x = Max(0, x-a)
		y = Max(0, y-b)

		if x+y <= c {
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}

}

func MakeGrid(h, w int) [][]Int {
	index := make([][]Int, h)
	data := make([]Int, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}

func Abs(x Int) Int {
	if x > 0 {
		return x
	}
	return -x
}

func Min(nums ...Int) Int {
	return nums[MinIdx(nums...)]
}

func MinIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num < nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

func Max(nums ...Int) Int {
	return nums[MaxIdx(nums...)]
}

func MaxIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

var (
	mod  Int
	fmod func(Int) Int = doNothing
)

// SetMod sets the mod. It must be called first.
func SetMod(newMod Int) {
	mod = newMod
	fmod = dynamicMod
}

func dynamicMod(m Int) Int {
	m %= mod
	if m < 0 {
		return m + mod
	}
	return m
}

func doNothing(m Int) Int {
	return m
}

// Mod returns m % mod.
func (m Int) Mod() Int {
	return fmod(m)
}

// Inv returns modular multiplicative inverse
func (m Int) Inv() Int {
	return m.Pow(Int(0).Sub(2))
}

// Pow returns m^n
func (m Int) Pow(n Int) Int {
	p := Int(1)
	for n > 0 {
		if n&1 == 1 {
			p.MulAs(m)
		}
		m.MulAs(m)
		n >>= 1
	}
	return p
}

// Add returns m+x
func (m Int) Add(x Int) Int {
	return (m + x).Mod()
}

// Sub returns m-x
func (m Int) Sub(x Int) Int {
	return (m - x).Mod()
}

// Mul returns m*x
func (m Int) Mul(x Int) Int {
	return (m * x).Mod()
}

// Div returns m/x
func (m Int) Div(x Int) Int {
	return m.Mul(x.Inv())
}

// AddAs assigns *m + x to *m and returns m
func (m *Int) AddAs(x Int) *Int {
	*m = m.Add(x)
	return m
}

// SubAs assigns *m - x to *m and returns m
func (m *Int) SubAs(x Int) *Int {
	*m = m.Sub(x)
	return m
}

// MulAs assigns *m * x to *m and returns m
func (m *Int) MulAs(x Int) *Int {
	*m = m.Mul(x)
	return m
}

// DivAs assigns *m / x to *m and returns m
func (m *Int) DivAs(x Int) *Int {
	*m = m.Div(x)
	return m
}

func (m *Int) MaxAs(x ...Int) *Int {
	*m = Max(append(x, *m)...)
	return m
}

func (m *Int) MinAs(x ...Int) *Int {
	*m = Min(append(x, *m)...)
	return m
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

/*

 */

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var a, b, c, x, y int
	scanf("%d %d %d %d %d\n", &a, &b, &c, &x, &y)

	reqDog := x - a
	if reqDog < 0 {
		reqDog = 0
	}

	reqCat := y - b
	if reqCat < 0 {
		reqCat = 0
	}

	if c >= reqDog+reqCat {
		fmt.Fprintln(writer, "YES")
	} else {
		fmt.Fprintln(writer, "NO")
	}
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func sum(nums ...int) (sum int) {
	for _, num := range nums {
		sum += num
	}
	return
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int64) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := int64(5); i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

//goland:noinspection GoUnusedFunction
func factorize(num int64) []int64 {
	factors := make([]int64, 0)

	for ftr := int64(2); ftr*ftr <= num; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > 1 {
		factors = append(factors, num)
	}

	return factors
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in, out := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)

	for ii := 0; ii < t; ii++ {
		var a, b, c, x, y int
		fmt.Fscan(in, &a, &b, &c, &x, &y)
		if a+c < x {
			fmt.Fprintln(out, "NO")
			continue
		}
		if a < x {
			c -= x - a
		}
		if b+c < y {
			fmt.Fprintln(out, "NO")
		} else {
			fmt.Fprintln(out, "YES")
		}
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a, b, c, x, y int
		fmt.Scan(&a)
		fmt.Scan(&b)
		fmt.Scan(&c)
		fmt.Scan(&x)
		fmt.Scan(&y)

		if x >= a {
			x -= a
			if c < x {
				fmt.Println("NO")
				continue
			} else {
				c -= x
			}
		}

		if y >= b {
			y -= b
			if c < y {
				fmt.Println("NO")
			} else {
				fmt.Println("YES")
			}
		}
		fmt.Println("YES")
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a, b, c, x, y int
		fmt.Scan(&a)
		fmt.Scan(&b)
		fmt.Scan(&c)
		fmt.Scan(&x)
		fmt.Scan(&y)

		if x >= a {
			x -= a
			if c < x {
				fmt.Println("NO")
				continue
			} else {
				c -= x
			}
		}

		if y >= b {
			y -= b
			if c < y {
				fmt.Println("NO")
			} else {
				fmt.Println("YES")
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type CF1675A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1675A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1675A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1675A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1675A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1675A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1675A
Date: 9/05/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1675/A
Problem: CF1675A
**/
func (in *CF1675A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		a, b, c, x, y := in.NextInt(), in.NextInt(), in.NextInt(), in.NextInt(), in.NextInt()

		if a >= x {
			a -= x
			a = 0
		} else {
			x-= a
			a = 0
			if x <= c {
				c -= x
				x = 0
			}
		}

		if b >= y {
			a -= y
			b = 0
		} else {
			y-= b
			b = 0
			if y <= c {
				c -= y
				y = 0
			}

		}

		if x == 0 && y == 0{
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}

	}

}

func NewCF1675A(r *bufio.Reader) *CF1675A {
	return &CF1675A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1675A(bufio.NewReader(os.Stdin)).Run()
}

package main

import (
	"fmt"
)

func main() {
	var ts int
	fmt.Scan(&ts)

	for i := 0; i < ts; i++ {
		var a, b, c, x, y int
		fmt.Scanf("%d %d %d %d %d\n", &a, &b, &c, &x, &y)

		ma := x - a
		if ma < 0 {
			ma = 0
		}
		mb := y - b
		if mb < 0 {
			mb = 0
		}

		if c >= ma+mb {
			fmt.Println("yes")
		} else {
			fmt.Println("no")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

//goland:noinspection GoUnusedFunction
func min(a int, nums ...int) int {
	min := a

	for _, num := range nums {
		if num < min {
			min = num
		}
	}
	return min
}

//goland:noinspection GoUnusedFunction
func max(a int, nums ...int) int {
	max := a

	for _, num := range nums {
		if num > max {
			max = num
		}
	}
	return max
}

//goland:noinspection GoUnusedFunction
func FprintlnArr(w io.Writer, arr []int) {
	for _, val := range arr {
		fmt.Fprint(w, val, " ")
	}
	fmt.Fprintln(w)
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var a, b, c, x, y int
		fmt.Fscan(in, &a, &b, &c, &x, &y)

		if int(math.Abs(float64(x-a)))+int(math.Abs(float64(y-b))) <= c {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var T int
	fmt.Fscan(in, &T)

	for t := 0; t < T; t++ {
		var n int
		fmt.Fscan(in, &n)

		var s string
		fmt.Fscan(in, &s)

		var c0 int
		for _, ch := range s {
			if ch == '0' {
				c0++
			}
		}

		arr := []int{}

		for i := 0; i < n; i++ {
			if c0 > 0 {
				if s[i] != '0' {
					arr = append(arr, i+1)
				}
				c0--
			} else {
				if s[i] != '1' {
					arr = append(arr, i+1)
				}
			}
		}

		if len(arr) == 0 {
			fmt.Fprintln(out, 0)
		} else {
			fmt.Fprintln(out, 1)
			fmt.Fprintf(out, "%d ", len(arr))
			for _, v := range arr {
				fmt.Fprintf(out, "%d ", v)
			}
			fmt.Fprintln(out)
		}
	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s string
		fmt.Fscan(reader, &n, &s)
		b := []byte(s)
		zeros := 0
		ones := 0
		for i := 0; i < n; i++ {
			if b[i] == '0' {
				zeros++
			} else {
				ones++
			}
		}
		bs := []byte(s)
		for i := 0; i < n; i++ {
			if zeros > 0 {
				bs[i] = '0'
				zeros--
			} else {
				bs[i] = '1'
			}
		}

		k := make([]int, 0)
		for i := 0; i < n; i++ {
			if b[i] != bs[i] {
				k = append(k, i+1)
			}
		}
		if len(k) > 0 {
			write(f, 1, "\n")
			write(f, len(k))
			for i := 0; i < len(k); i++ {
				write(f, " ", k[i])
			}
			write(f, "\n")
		} else {
			write(f, 0, "\n")
		}

	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	var t int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in,&t)
	out := os.Stdout
	for u:=1;u<=t;u++{
		var n int
		fmt.Fscan(in,&n)
		var s []byte
		fmt.Fscan(in,&s)
		check := false
		r1 := false
		for i:=0;i<len(s);i++{
			if r1&&s[i]=='0'{
				check = true
				break
			}
			if s[i]=='1'{
				r1 =true
			}
		}
		ans := 0
		ops := [][]int{}
		for check {
			ans ++
			vis := [1005]int{}
			sub := []int{}
			for i:=0;i<len(s);i++{
				if s[i]=='1'{
					for j:=len(s)-1;j>=i+1;j--{
						if s[j]=='0'&&vis[j]==0{
							vis[j]=1
							sub = append(sub,i,j)
							break
						}
					}
				}
			}
			sort.Ints(sub)
			for i:=0;i<len(sub)/2;i++{
				s[sub[i]],s[sub[len(sub)-i-1]] = s[sub[len(sub)-i-1]],s[sub[i]]
			}
			ops = append(ops,sub)
			r1 = false
			check = false
			for i:=0;i<len(s);i++{
				if r1&&s[i]=='0'{
					check = true
					break
				}
				if s[i]=='1'{
					r1 =true
				}
			}
		}
		fmt.Fprintln(out,ans)
		for i:=0;i<len(ops);i++{
			fmt.Fprintf(out,"%d ", len(ops[i]))
			for j:=0;j<len(ops[i]);j++{
				fmt.Fprintf(out,"%d ", ops[i][j]+1)
			}
			fmt.Fprintln(out)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func solve(n int, s string) {
	ans := ([]int)(nil)
	i, j := 0, n-1
	for i < j {
		for i < j && s[i] == '0' {
			i++
		}
		for i < j && s[j] == '1' {
			j--
		}
		if i < j {
			ans = append(ans, i+1, j+1)
			i++
			j--
		}
	}
	sort.Slice(ans, func(i, j int) bool { return ans[i] < ans[j] })

	if len(ans) == 0 {
		printf("0\n")
		return
	}
	printf("1\n%v ", len(ans))
	for _, i := range ans {
		printf("%v ", i)
	}
	printf("\n")
}

func main() {
	defer writer.Flush()
	//redirectInputToFile(reader, "input.txt")

	T := 1
	scan(&T)
	for t := 0; t < T; t++ {
		var (
			n int
			s string
		)
		scan(&n, &s)
		solve(n, s)
	}
}

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func scan(a ...interface{})             { fmt.Fscan(reader, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

func redirectInputToFile(r *bufio.Reader, fp string) {
	f, err := os.Open(fp)
	if err != nil {
		panic(err)
	}
	r.Reset(f)
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strings"
)

/*
4
1
0
1
1
2
10
2
01
---
0
0
2 1 2
0
======
1
2
10
---
2 1 2
*/

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	bld := strings.Builder{}

	var t = 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		var n int
		var s string
		scanf("%d\n%s\n", &n, &s)

		zeroCnt := 0
		for _, r := range s {
			if r == '0' {
				zeroCnt++
			}
		}

		oneIdxs := make([]int, 0)
		zeroIdxs := make([]int, 0)

		for i, j := 0, zeroCnt; i < zeroCnt && j < len(s); {
			if s[i] == '0' {
				i++
				continue
			}
			if s[j] == '1' {
				j++
				continue
			}

			oneIdxs = append(oneIdxs, i)
			zeroIdxs = append(zeroIdxs, j)

			i++
			j++
		}

		if len(oneIdxs) != 0 {
			fmt.Fprintln(&bld, 1)
			fmt.Fprintf(&bld, "%d ", 2*len(oneIdxs))

			for _, idx := range oneIdxs {
				fmt.Fprintf(&bld, "%d ", idx+1)
			}
			for _, idx := range zeroIdxs {
				fmt.Fprintf(&bld, "%d ", idx+1)
			}
			fmt.Fprintln(&bld)
		} else {
			fmt.Fprintln(&bld, 0)
		}
	}

	printf("%s", bld.String())
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

//goland:noinspection GoUnusedType
type pair struct {
	x int64
	y int64
}

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

//goland:noinspection GoUnusedFunction
func printf(f string, a ...interface{}) {
	if _, err := fmt.Fprintf(writer, f, a...); err != nil {
		panic(err)
	}
}

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

//goland:noinspection GoUnusedFunction
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

//goland:noinspection GoUnusedFunction
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//goland:noinspection GoUnusedFunction
func isPrime(n int) bool {
	if n == 2 || n == 3 {
		return true
	}

	if n <= 1 || n%2 == 0 || n%3 == 0 {
		return false
	}

	for i := 5; i*i <= n; i += 6 {
		if n%i == 0 || n%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in, out := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var tc int
	fmt.Fscan(in, &tc)
	for ; tc > 0; tc-- {
		var n int
		var s string
		fmt.Fscan(in, &n, &s)
		zeros := 0
		for _, ch := range s {
			if ch == '0' {
				zeros++
			}
		}
		r := []int{}
		for i, ch := range s {
			expected := '0'
			if i >= zeros {
				expected = '1'
			}
			if expected != ch {
				r = append(r, i+1)
			}
		}
		if len(r) == 0 {
			out.WriteString("0\n")
			continue
		}
		out.WriteString("1\n")
		fmt.Fprintf(out, "%d", len(r))
		for _, i := range r {
			fmt.Fprintf(out, " %d", i)
		}
		out.WriteByte('\n')
	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s string
		fmt.Fscan(reader, &n, &s)
		if t == 42 {
			fmt.Println(n, s)
		}
		b := []byte(s)
		zeros := 0
		ones := 0
		for i := 0; i < n; i++ {
			if b[i] == '0' {
				zeros++
			} else {
				ones++
			}
		}
		bs := []byte(s)
		for i := 0; i < n; i++ {
			if zeros > 0 {
				bs[i] = '0'
				zeros--
			} else {
				bs[i] = '1'
			}
		}

		k := make([]int, 0)
		for i := 0; i < n; i++ {
			if b[i] != bs[i] {
				k = append(k, i+1)
			}
		}
		if len(k) > 0 {
			write(f, 1, "\n")
			write(f, len(k))
			for i := 0; i < len(k); i++ {
				write(f, " ", k[i])
			}
			write(f, "\n")
		} else {
			write(f, 0, "\n")
		}

	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s string
		fmt.Fscan(reader, &n, &s)
		if t == 42 {
			fmt.Println(n, s)
		}
		b := []byte(s)
		kks := make([][]int, 0)
		for true {
			found_one := false
			found_zero := false
			kk := make([]int, 0)
			start := n - 1
			for start >= 0 {
				if found_zero && b[start] == '1' {
					kk = append(kk, start)
					found_one = true
				} else if !found_one && b[start] == '0' {
					kk = append(kk, start)
					found_zero = true
				}
				start--
			}
			if found_one {
				kks = append(kks, kk)
				k := len(kk)
				for i := 0; i < k/2; i++ {
					b[kk[i]], b[kk[k-1-i]] = b[kk[k-1-i]], b[kk[i]]
				}
			} else {
				break
			}
		}
		write(f, len(kks), "\n")
		for i := 0; i < len(kks); i++ {
			write(f, len(kks[i]))
			for j := len(kks[i]) - 1; j >= 0; j-- {
				write(f, " ", kks[i][j]+1)
			}
			write(f, "\n")
		}

	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s string
		fmt.Fscan(reader, &n, &s)
		b := []byte(s)
		kks := make([][]int, 0)
		for true {
			found_one := false
			found_zero := false
			kk := make([]int, 0)
			start := n - 1
			for start >= 0 {
				if found_zero && b[start] == '1' {
					kk = append(kk, start)
					found_one = true
				} else if !found_one && b[start] == '0' {
					kk = append(kk, start)
					found_zero = true
				}
				start--
			}
			if found_one {
				kks = append(kks, kk)
				k := len(kk)
				for i := 0; i < k/2; i++ {
					b[kk[i]], b[kk[k-1-i]] = b[kk[k-1-i]], b[kk[i]]
				}
			} else {
				break
			}
		}
		write(f, len(kks), "\n")
		for i := 0; i < len(kks); i++ {
			write(f, len(kks[i]))
			for j := len(kks[i]) - 1; j >= 0; j-- {
				write(f, " ", kks[i][j]+1)
			}
			write(f, "\n")
		}

	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var t int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in,&t)
	out := os.Stdout
	for u:=1;u<=t;u++{
		var n int
		fmt.Fscan(in,&n)
		var s []byte
		fmt.Fscan(in,&s)
		check := false
		r1 := false
		for i:=0;i<len(s);i++{
			if r1&&s[i]=='0'{
				check = true
				break
			}
			if s[i]=='1'{
				r1 =true
			}
		}
		ans := 0
		ops := [][]int{}
		for check {
			ans++
			b0 := -1
			for i:=len(s)-1;i>=0;i--{
				if s[i]!='1'{
					b0 = i
					break
				}
			}
			subs := []int{}
			b1 := -1
			for i:=b0;i>=0;i--{
				if s[i]=='1'{
					b1 = i
					break
				}
				subs = append([]int{i},subs...)
			}
			cnt :=  len(subs)
			temp := []int{}
			for i:=0;i<=b1;i++{
				if s[i]=='1'{
					cnt--
					temp = append(temp,i)
					if cnt==0{
						break
					}
				}
			}
			subs = append(temp,subs...)
			for i:=0;i<len(subs)/2;i++{
				s[subs[i]],s[subs[len(subs)-i-1]] = s[subs[len(subs)-i-1]],s[subs[i]]
			}
			ops = append(ops,subs)
			check = false
			r1 = false
			for i:=0;i<len(s);i++{
				if r1&&s[i]=='0'{
					check = true
					break
				}
				if s[i]=='1'{
					r1 =true
				}
			}
		}
		fmt.Fprintln(out,ans)
		for i:=0;i<len(ops);i++{
			fmt.Fprintf(out,"%d ", len(ops[i]))
			for j:=0;j<len(ops[i]);j++{
				fmt.Fprintf(out,"%d ", ops[i][j]+1)
			}
			fmt.Fprintln(out)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var t int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in,&t)
	out := os.Stdout
	for u:=1;u<=t;u++{
		var n int
		fmt.Fscan(in,&n)
		var s []byte
		fmt.Fscan(in,&s)
		check := false
		r1 := false
		for i:=0;i<len(s);i++{
			if r1&&s[i]=='0'{
				check = true
				break
			}
			if s[i]=='1'{
				r1 =true
			}
		}
		ans := 0
		ops := [][]int{}
		for check {
			ans++
			b0 := -1
			for i:=len(s)-1;i>=0;i--{
				if s[i]!='1'{
					b0 = i
					break
				}
			}
			subs := []int{}
			b1 := -1
			for i:=b0;i>=0;i--{
				if s[i]=='1'{
					b1 = i
					break
				}
				subs = append([]int{i},subs...)
			}
			cnt :=  len(subs)
			for i:=b1;i>=0;i--{
				if s[i]=='1'{
					cnt--
					subs = append([]int{i},subs...)
					if cnt==0{
						break
					}
				}
			}
			for i:=0;i<len(subs)/2;i++{
				s[subs[i]],s[subs[len(subs)-i-1]] = s[subs[len(subs)-i-1]],s[subs[i]]
			}
			ops = append(ops,subs)
			check = false
			r1 = false
			for i:=0;i<len(s);i++{
				if r1&&s[i]=='0'{
					check = true
					break
				}
				if s[i]=='1'{
					r1 =true
				}
			}
		}
		fmt.Fprintln(out,ans)
		for i:=0;i<len(ops);i++{
			fmt.Fprintf(out,"%d ", len(ops[i]))
			for j:=0;j<len(ops[i]);j++{
				fmt.Fprintf(out,"%d ", ops[i][j]+1)
			}
			fmt.Fprintln(out)
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var t int
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		var n int
		var s string
		fmt.Scanf("%d\n%s", &n, &s)
		solve(n, s)
	}
}

func solve(n int, s string) {
	ans := ([]int)(nil)
	i, j := 0, n-1
	for i < j {
		for i < j && s[i] == '0' {
			i++
		}
		for i < j && s[j] == '1' {
			j--
		}
		if i < j {
			ans = append(ans, i+1, j+1)
			i++
			j--
		}
	}
	sort.Slice(ans, func(i, j int) bool { return ans[i] < ans[j] })

	if len(ans) == 0 {
		fmt.Println(0)
		return
	}
	fmt.Printf("1\n%d ", len(ans))
	for _, i := range ans {
		fmt.Printf("%d ", i)
	}
	fmt.Printf("\n")
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)

	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		STRING := make([]byte, 0)
		fmt.Fscan(input, &STRING)

		var ans int
		ARR := make([]int, 0)
		B := make([]int, 0)
		for i := 0; i < n; i++ {
			q := int(STRING[i])
			ARR = append(ARR, q)
			B = append(B, q)
		}
		sort.Ints(B)
		for i := 0; i < n; i++ {
			if B[i] != ARR[i] {
				ans++
			}
		}
		fmt.Println(ans)

	}

}

package main
import(
    "fmt"
    "bufio"
    "os"
    "strings"
    "sort"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		var word string
		fmt.Fscan(in,&word)
		list:= strings.Split(word,"")
		sort.Strings(list)
		counter:=0
		for j:=0;j<n;j++{
			if list[j] != string(word[j]) {
				counter++
			}
		}
		fmt.Fprintln(out,counter)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

type CF1552A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1552A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1552A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1552A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1552A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1552A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1552A
Date: 25/11/21
User: epradere
URL: https://codeforces.com/problemset/problem/1552/A
Problem: CF1552A
**/
func (in *CF1552A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		arr := make([]int, n)
		ord := make([]int, n)
		str := in.NextString()
		for i := 0; i < n; i++ {
			arr[i] = int(str[i])
			ord[i] = int(str[i])
		}

		sort.Ints(ord)

		ans := 0
		for i := 0; i < n; i++ {
			if arr[i] != ord[i] {
				ans++
			}
		}

		fmt.Println(ans)
	}
}

func NewCF1552A(r *bufio.Reader) *CF1552A {
	return &CF1552A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1552A(bufio.NewReader(os.Stdin)).Run()
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var (
	reader = bufio.NewReader(os.Stdin)
	t, n   int
	s      string
)

func stringToRuneSlice(s string) []rune {
	var x []rune
	for _, c := range s {
		x = append(x, rune(c))
	}
	return x
}

func solve(n int, s string) int {
	p := stringToRuneSlice(s)
	q := stringToRuneSlice(s)
	sort.Slice(q, func(i, j int) bool {
		return q[i] < q[j]
	})
	r := 0
	for i := range q {
		if p[i] != q[i] {
			r++
		}
	}
	return r
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n, &s)
		fmt.Println(solve(n, s))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strings"
)

var (
	reader *bufio.Reader = bufio.NewReader(os.Stdin)
	writer *bufio.Writer = bufio.NewWriter(os.Stdout)
)

func main() {
	defer writer.Flush()

	var (
		t, n int
		s    string
	)
	fmt.Fscanf(reader, "%d\n", &t)

	for i := 0; i < t; i++ {
		fmt.Fscanf(reader, "%d\n%s\n", &n, &s)

		arr := strings.Split(s, "")
		sort.Strings(arr)

		ans := 0
		for i := 0; i < len(arr); i++ {
			if arr[i] != string([]rune(s)[i]) {
				ans++
			}
		}
		fmt.Fprintf(writer, "%d\n", ans)

	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	r := bufio.NewReaderSize(os.Stdin, 1024 * 1024)

	var T int

	fmt.Fscanf(r, "%d\n", &T)

	for t := 0; t < T; t++ {
		var n int
		var s string
		fmt.Fscanf(r, "%d\n%s\n", &n, &s)

		x := []byte(s)
		sort.Slice(x, func(i, j int) bool {
			return x[i] < x[j]
		})

		res := 0
		for i := 0; i < n; i++ {
			if x[i] != s[i] {
				res++
			}
		}
		fmt.Println(res)
	}
}

package main

import (
	"fmt"
	"sort"
)

type btaray []byte
func (this btaray) Len() int {
	return len(this)
}
func (this btaray) Less(i, j int) bool {
	return this[i] < this[j]
}
func (this btaray) Swap(i, j int) {
	this[i], this[j] = this[j], this[i]
}

func main()  {
	var t int
	fmt.Scan(&t)
	for ; t > 0;t-- {
		var n int
		fmt.Scan(&n)
		var s string
		fmt.Scan(&s)
		t := btaray{}
		for _,i:=range s{
			j := byte(i)
			t = append(t,j)
		}
		//t := s
		sort.Sort(t)
		ans := 0
		for i,j:=range s{
			if t[i]!=byte(j){
				ans ++
			}
		}
		fmt.Println(ans)
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
)

var (
	t      int
	input  io.Reader = bufio.NewReader(os.Stdin)
	output           = bufio.NewWriter(os.Stdout)
)

func solve() {
	var n int
	fmt.Fscan(input, &n)

	var s string
	fmt.Fscan(input, &s)

	sBytes := make([]byte, n)
	sBytes = []byte(s)
	sSorted := make([]byte, 0)
	sSorted = append(sSorted, sBytes...)

	sort.Slice(sSorted, func(i, j int) bool {
		return sSorted[i] < sSorted[j]
	})

	ans := 0
	for i := 0; i < n; i++ {
		if sBytes[i] != sSorted[i] {
			ans += 1
		}
	}

	fmt.Fprintln(output, ans)
}

func main() {
	t = 1
	fmt.Fscan(input, &t)

	for t > 0 {
		t--
		solve()
	}

	defer output.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var (
	out = bufio.NewWriter(os.Stdout)
	in  = bufio.NewReader(os.Stdin)
)

func main() {
	var test int
	fmt.Fscan(in, &test)
	for i := 0; i < test; i++ {
		solve()
	}

}

func solve() {
	var n int
	fmt.Fscan(in, &n)
	var givenString string
	fmt.Fscan(in, &givenString)
	var temp runeSort
	temp = []rune(givenString)
	sort.Sort(temp)
	var ans int
	for i := 0; i < len(temp); i++ {
		if string(temp[i]) != string(givenString[i]) {
			ans++
		}
	}
	fmt.Println(ans)
}

func printArray(arr []int) {
	for i := 1; i < len(arr); i++ {
		fmt.Print(arr[i], " ")
	}
	fmt.Println()
}

type runeSort []rune

func (r runeSort) Len() int           { return len(r) }
func (r runeSort) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
func (r runeSort) Less(i, j int) bool { return r[i] < r[j] }

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var t int
	fmt.Scan(&t)

	var s, tmp string
	var n int
	var k int

	var tmp2 []string

	for i := 0; i < t; i++ {
		fmt.Scan(&n)
		fmt.Scan(&s)

		tmp2 = strings.Split(s, "")
		sort.Strings(tmp2)
		tmp = strings.Join(tmp2, "")

		k = 0
		for j := 0; j < n; j++ {
			if s[j] != tmp[j] {
				k++
			}
		}
		fmt.Println(k)
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var l int
		var s string
		fmt.Scan(&l, &s)
		a := []byte(s)
		b := make([]byte, len(a))
		copy(b, a)
		sort.SliceStable(a, func(i, j int) bool {
			return a[i] < a[j]
		})
		res := 0
		for i := range a {
			if a[i] != b[i] {
				res++
			}
		}
		fmt.Println(res)
	}
}

package main

import (
	"fmt"
	"sort"
)

func dd(a string) {
	arr := []byte(a)
	sort.Slice(arr, func(a, b int) bool {
		return arr[a] < arr[b]
	})
	res := 0
	for i := 0; i < len(a); i++ {
		if arr[i] != a[i] {
			res++
		}
	}
	fmt.Println(res)
}

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a int
		var s string
		fmt.Scan(&a, &s)
		dd(s)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func main() {
	defer write.Flush()
	var t int
	fmt.Fscan(read, &t)
	for i := 0; i < t; i++ {
		solve()
	}
}

func solve() {
	var (
		n int
		s string
	)
	fmt.Fscan(read, &n, &s)
	fmt.Fprintln(write, getMax(s, n))

}

func getMax(s string, n int) int {

	var k int = 0
	b := []byte(s)
	sort.Slice(b, func(i, j int) bool {
		return b[i] < b[j]
	})
	for i := 0; i < len(s); i++ {
		if b[i] != s[i] {
			k++
		}
	}
	return k
}

package main

import (
	"fmt"
	"sort"
)

type byteSlice []byte

func (p byteSlice) Len() int           { return len(p) }
func (p byteSlice) Less(i, j int) bool { return p[i] < p[j] }
func (p byteSlice) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }

func getMinimumK(s string, n int) (k int) {
	bytes := make(byteSlice, 0)
	str := []byte(s)
	bytes = append(bytes, str...)
	sort.Sort(bytes)
	for i := 0; i < len(s); i++ {
		if bytes[i] != str[i] {
			k++
		}
	}
	return
}

func main() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var (
			n int
			s string
		)
		fmt.Scan(&n, &s)
		fmt.Println(getMinimumK(s, n))
	}
}

package main

import (
	"fmt"
	"os"
	"sort"
	"bufio"
)

var (
	read = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func solve() {
	n := 0
	var word string
	fmt.Fscan(read, &n)
	fmt.Fscan(read, &word)
	nword := SortStringByCharacter(word)
	sum := 0
	for i := 0; i < len(nword); i++ {
		if nword[i] != word[i] {
			sum += 1
		}
	}
	fmt.Fprintln(write, sum)
}

func main() {
	defer write.Flush()
	t :=  0
	fmt.Fscan(read, &t)
	for i := 0; i < t; i++ {
		solve()
	}
}

type ByRune []rune

func (r ByRune) Len() int           { return len(r) }
func (r ByRune) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
func (r ByRune) Less(i, j int) bool { return r[i] < r[j] }

func StringToRuneSlice(s string) []rune {
      var r []rune
      for _, runeValue := range s {
              r = append(r, runeValue)
      }
      return r
}

func SortStringByCharacter(s string) string {
      var r ByRune = StringToRuneSlice(s)
      sort.Sort(r)
      return string(r)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

type Scanner struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) *Scanner {
	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanWords)
	return &Scanner{scanner}
}

func (s *Scanner) Word() string {
	s.Scan()
	return s.Text()
}

func (s *Scanner) Int() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func (s *Scanner) Int64() int64 {
	s.Scan()
	n, _ := strconv.ParseInt(s.Text(), 10, 64)
	return n
}

func (s *Scanner) Words(count int) []string {
	words := make([]string, count)
	for i := range words {
		words[i] = s.Word()
	}
	return words
}

func (s *Scanner) Ints(count int) []int {
	ints := make([]int, count)
	for i := range ints {
		ints[i] = s.Int()
	}
	return ints
}

func (s *Scanner) Int64s(count int) []int64 {
	int64s := make([]int64, count)
	for i := range int64s {
		int64s[i] = s.Int64()
	}
	return int64s
}

func solve(s string) int {
	ss := []byte(s)
	sort.Slice(ss, func(i, j int) bool { return ss[i] < ss[j] })

	res := 0
	for i, ch := range []byte(s) {
		if ss[i] != ch {
			res += 1
		}
	}
	return res
}

func main() {
	stdin := NewWordScanner(os.Stdin)
	tests := stdin.Int()

	for i := 0; i < tests; i += 1 {
		stdin.Int()
		s := stdin.Word()
		fmt.Println(solve(s))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

func init() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 4096), 1e9)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func _int() int {
	s := _string()
	i := 0
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int(r - '0')
	}
	return i
}

func _int64() int64 {
	s := _string()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func _string() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func main() {
	defer writer.Flush()
	for t := _int(); t > 0; t-- {
		n := _int()
		s := _string()
		printf("%d\n", sol(n, s))
	}
}

func sol(n int, s string) int {
	b := []byte(s)
	sort.Slice(b, func(il, ir int) bool {
		return b[il] < b[ir]
	})
	k := 0
	for i := range b {
		if b[i] != s[i] {
			k++
		}
	}
	return k
}

package main

import (
    "fmt"
    "sort"
)

func main() {
    var t int
    //fmt.Scanf("%d", &t)
    fmt.Scan(&t)
    for i:=0 ; i<t; i+=1{
        var n int
        //fmt.Scanf("%d", &n)
        fmt.Scan(&n)
        var s string
        //fmt.Scanf("%s", &s)
        fmt.Scan(&s)
        //slce := []string{}
        var slce []string
        for j:=0; j<len(s); j+=1{
            slce = append(slce, string(s[j]) )
        }
        sort.Strings(slce)
        ans := 0
        for j:=0; j<len(s); j+=1{
            if string(s[j]) != slce[j]{
                ans += 1
            }
        }
        fmt.Println(ans)
    }
}

package main

import (
    "fmt"
    "sort"
)

func main() {
    var t int
    fmt.Scanf("%d", &t)
    for i:=0 ; i<t; i+=1{
        var n int
        fmt.Scanf("%d", &n)
        var s string
        fmt.Scanf("%s", &s)
        //slce := []string{}
        var slce []string
        for j:=0; j<len(s); j+=1{
            slce = append(slce, string(s[j]) )
        }
        sort.Strings(slce)
        ans := 0
        for j:=0; j<len(s); j+=1{
            if string(s[j]) != slce[j]{
                ans += 1
            }
        }
        fmt.Println(ans)
    }
}

package main

import (
    "fmt"
    "sort"
)

func main() {
    var t int
    fmt.Scanf("%d", &t)
    for i:=0 ; i<t; i+=1{
        var n int
        fmt.Scanf("%d", &n)
        var s string
        fmt.Scanf("%s", &s)
        slce := []string{}
        for j:=0; j<len(s); j+=1{
            slce = append(slce, string(s[j]) )
        }
        sort.Strings(slce)
        ans := 0
        for j:=0; j<len(s); j+=1{
            if string(s[j]) != slce[j]{
                ans += 1
            }
        }
        fmt.Println(ans)
    }
}

package main

import (
    "fmt"
    "sort"
)

func main() {
    t := 0
    fmt.Scanf("%d", &t)
    for i:=0 ; i<t; i+=1{
        n:= 0
        fmt.Scanf("%d", &n)
        s:= ""
        fmt.Scanf("%s", &s)
        slce := []string{}
        for j:=0; j<len(s); j+=1{
            slce = append(slce, string(s[j]) )
        }
        sort.Strings(slce)
        ans := 0
        for j:=0; j<len(s); j+=1{
            if string(s[j]) != slce[j]{
                ans += 1
            }
        }
        fmt.Println(ans)
    }
}


package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF1153D(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	var n, v, leafCnt int
	Fscan(in, &n)
	tp := make([]int8, n)
	for i := range tp {
		Fscan(in, &tp[i])
	}
	g := make([][]int, n)
	for w := 1; w < n; w++ {
		Fscan(in, &v)
		g[v-1] = append(g[v-1], w)
	}

	var f func(int) int
	f = func(v int) (cnt int) {
		if g[v] == nil {
			leafCnt++
			tp[v] = 1
			return 1
		}
		if tp[v] == 0 {
			for _, w := range g[v] {
				cnt += f(w)
			}
		} else {
			cnt = 1e9
			for _, w := range g[v] {
				if c := f(w); c < cnt {
					cnt = c
				}
			}
		}
		return
	}
	Fprint(_w, leafCnt+1-f(0))
}

func main() { CF1153D(os.Stdin, os.Stdout) }

package main

import (
	"bufio"
	"fmt"
	"os"
)

func addD(u, v int, edges [][]int) {
	if len(edges[u]) == 0 {
		edges[u] = make([]int, 0)
	}
	edges[u] = append(edges[u], v)
}
func dfsD(root, pre int, edges [][]int, dp, mat []int) int {
//	fmt.Printf("root=%d\n", root)

	sun := 0
	dpsum := 0
	maxsum := 0
	for _, next := range edges[root] {
		if pre == next {
			continue
		}
		sun += dfsD(next, root, edges, dp, mat)
		dpsum += dp[next]
		if maxsum == 0|| maxsum > dp[next] {
			maxsum = dp[next]
		}
	}
	if sun == 0 {
		dp[root] = 1
		return 1
	}
	if mat[root] == 0 {
		dp[root] = dpsum
	} else {
		dp[root] = maxsum
	}
//	fmt.Printf("root=%d dp=%d\n", root, dp[root])
	return sun
}
func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, pre int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int, n+1)
	edges := make([][]int, n+1)
	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d", &mat[i+1])
	}
	fmt.Fscanf(buf, "\n")
	for i := 2; i <= n; i++ {
		fmt.Fscanf(buf, "%d", &pre)
		addD(i, pre, edges)
		addD(pre, i, edges)
	}
	fmt.Fscanf(buf, "\n")
	dp := make([]int, n+1)
	sum:=dfsD(1, -1, edges, dp, mat)
//	fmt.Printf("%v\n",dp)
	fmt.Printf("%d\n", sum - dp[1]+1)

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

const INF int = 1000000007
var son [][]int
var limit, f []int
var leaf = 0

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func dfs(x int) {
	if len(son[x]) == 0 {
		leaf++
		f[x] = -1
		return
	}
	max, sum := -INF, 0
	for _, y := range son[x] {
		dfs(y)
		if f[y] > max {
			max = f[y]
		}
		sum += f[y]
	}
	if limit[x] == 0 {  // min
		f[x] = sum
	} else {  // max
		f[x] = max
	}
}

func main() {
	defer writer.Flush()

	var n, x int
	scanf("%d\n", &n)
	// printf("%d\n", n)
	for i := 0; i < n; i++ {
		scanf("%d", &x)
		// printf("%d ", x)
		limit = append(limit, x)
		f = append(f, 0)
		son = append(son, []int{})
	}
	scanf("\n");
	// printf("\n");
	for i := 1; i < n; i++ {
		scanf("%d", &x)
		// printf("%d %d\n", x, i + 1)
		son[x - 1] = append(son[x - 1], i)
	}
	dfs(0)
	printf("%d\n", leaf + f[0] + 1)
	// for i := 0; i < n; i++ {
	// 	printf("%d %d %d\n", i, f[i], len(son[i]))
	// }
}

package main

import "fmt"

const N int = 300010
const INF int = 1000000007
var son [N][]int
var limit, f, leaf [N]int

func Max(a, b int) int {
    if a > b {
        return a
    }
    return b
}

func dfs(x int) int {
    if son[x] == nil {
        leaf[x] = 1
        f[x] = 0
        return f[x]
    }
    max1, max2 := -INF, -INF
    for _, y := range son[x] {
        tmp := dfs(y)
        leaf[x] += leaf[y]
        max1 = Max(max1, tmp)
        max2 = Max(max2, leaf[y] + tmp)
    }
    if limit[x] == 0 {  // min
        f[x] = max2 - leaf[x]
    } else {  // max
        f[x] = max1
    }
    return f[x]  // negative
}

func main() {
    var n int
    fmt.Scan(&n)
    for i := 1; i <= n; i++ {
        fmt.Scan(&limit[i])
    }
    for i := 2; i <= n; i++ {
        var father int
        fmt.Scan(&father)
        son[father] = append(son[father], i)
    }
    ans := dfs(1)
    fmt.Println(leaf[1] + ans)
}

package main

import "fmt"

const N int = 300010
const INF int = 1000000007
var son [N][]int
var limit, f, leaf [N]int

func Max(a, b int) int {
    if a > b {
        return a
    }
    return b
}

func dfs(x int) int {
    if son[x] == nil {
        leaf[x] = 1
        f[x] = 0
        return f[x]
    }
    max1, max2 := -INF, -INF
    for _, y := range son[x] {
        tmp := dfs(y)
        leaf[x] += leaf[y]
        max1 = Max(max1, tmp)
        max2 = Max(max2, leaf[y] + tmp)
    }
    if limit[x] == 0 {  // min
        f[x] = max2 - leaf[x]
    } else {  // max
        f[x] = max1
    }
    return f[x]  // negative
}

func main() {
    var n int
    fmt.Scanf("%d", &n)
    for i := 1; i <= n; i++ {
        fmt.Scanf("%d", &limit[i])
    }
    for i := 2; i <= n; i++ {
        var father int
        fmt.Scanf("%d", &father)
        son[father] = append(son[father], i)
    }
    ans := dfs(1)
    fmt.Println(leaf[1] + ans)
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF1153D(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	var n, v, leafCnt int
	Fscan(in, &n)
	tp := make([]int8, n)
	for i := range tp {
		Fscan(in, &tp[i])
	}
	g := make([][]int, n)
	for w := 1; w < n; w++ {
		Fscan(in, &v)
		g[v-1] = append(g[v-1], w)
	}

	var f func(int) int
	f = func(v int) (cnt int) {
		if g[v] == nil {
			leafCnt++
			tp[v] = 1
			return 1
		}
		if tp[v] == 0 {
			for _, w := range g[v] {
				if c := f(w); tp[w] == 0 {
					cnt += c
				} else {
					cnt++
				}
			}
		} else {
			cnt = 1e9
			hasMax := false
			for _, w := range g[v] {
				if c := f(w); c < cnt {
					cnt = c
				}
				if tp[w] != 0 {
					hasMax = true
				}
			}
			if hasMax {
				cnt = 1
			}
		}
		return
	}
	Fprint(_w, leafCnt+1-f(0))
}

func main() { CF1153D(os.Stdin, os.Stdout) }


package main

import (
	"bufio"
	"os"
	"sort"
	"strconv"
	"strings"
)

func abs(a int) int {
	if a >= 0 {
		return a
	} else {
		return a * -1
	}
}

func main() {
	var arrI []int
	var arrS []string
	var tmp, min, count int
	min = 2000000000
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	line, _ := reader.ReadString('\n')
	line, _ = reader.ReadString('\n')
	arrS = strings.Split(strings.TrimSpace(line), " ")
	for j := range arrS {
		tmp, _ = strconv.Atoi(arrS[j])
		arrI = append(arrI, tmp)
	}
	sort.Ints(arrI)
	for i := 0; i < len(arrI)-1; i++ {
		if abs(arrI[i]-arrI[i+1]) < min {
			min = abs(arrI[i] - arrI[i+1])
			count = 1
		} else if abs(arrI[i]-arrI[i+1]) == min {
			count++
		}
	}
	writer.WriteString(strconv.Itoa(min) + " " + strconv.Itoa(count))
	writer.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

func solve() {
	n := readInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = readInt()
	}
	sort.Ints(a)
	min := math.MaxInt32
	cnt := 0
	for i := 1; i < n; i++ {
		d := a[i] - a[i-1]
		if d < min {
			min = d
			cnt = 1
		} else if d == min {
			cnt++
		}
	}
	fmt.Println(min, cnt)
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}


package main

import (
	"bufio"
	//	"container/heap" for heap.Init()
	"fmt"
	"os"
	"runtime"
)

func check(b bool) {
	if !b {
		_, _, line, _ := runtime.Caller(1)
		fmt.Printf("check failed line %d\n", line)
		os.Exit(-1)
	}
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

type IntHeap []int

func (h IntHeap) Len() int            { return len(h) }
func (h IntHeap) Less(i, j int) bool  { return h[i] < h[j] }
func (h IntHeap) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *IntHeap) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

const (
	INIT = -1
)

var (
	k   int
	n   []int
	ans []int
)

// a >= b
func ge(a, b []int) bool {
	check(len(a) == len(b))
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			return a[i] > b[i]
		}
	}
	return true
}

func ok(a []int) bool {
	cnt := make([]int, 10)
	uniq := 0
	for i := 0; i < len(a); i++ {
		if cnt[a[i]] == 0 {
			uniq++
			if uniq > k {
				return false
			}
		}
		cnt[a[i]]++
	}
	return true
}

func toi(a []int) int {
	rv := 0
	for _, x := range a {
		rv *= 10
		rv += x
	}
	return rv
}

func gen(d int) []int {
	rv := make([]int, len(n))
	for i := 0; i < len(n); i++ {
		rv[i] = d
	}
	return rv
}

func can(a, b int) {
	for i := 0; i < len(n); i++ {
		if n[i] < b { // change after prefix of length i
			t := make([]int, len(n))
			copy(t, n)

			if n[i] < a {
				t[i] = a
			} else {
				t[i] = b
			}

			for j := i + 1; j < len(n); j++ {
				t[j] = a
			}

			//			fmt.Printf("a %d b %d ans %v t %v ge %t\n", a, b, ans, t, ge(ans, t))
			if ge(ans, t) {
				copy(ans, t)
			}
		}

		if n[i] != a && n[i] != b { // prefix no longer valid
			return
		}

	}
}

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var tc int
	fmt.Fscan(r, &tc)

	for ; tc > 0; tc-- {

		var s string
		fmt.Fscan(r, &s, &k)
		n = make([]int, len(s))
		for i := 0; i < len(s); i++ {
			n[i] = int(s[i] - '0')
		}

		if ok(n) {
			fmt.Println(toi(n))
			continue
		}

		ans = gen(9)
		for i := 8; i > 0; i-- {
			t := gen(i)
			if ge(t, n) {
				ans = t
			}
		}

		if k > 1 {
			for a := 0; a < 10; a++ {
				for b := a + 1; b < 10; b++ {
					can(a, b)
				}
			}
		}

		fmt.Println(toi(ans))

	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t int
	var s string
	var k int
	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &s, &k)
		w1 := do(s, k)
		fmt.Fprint(w, w1)
		fmt.Fprintln(w)
	}
}

func do(t string, k int) string {
	s := make([]byte, len(t))
	for i := range t {
		s[i] = t[i] - '0'
	}
	v := make([]byte, 10)
	w := make([]byte, len(t))
	dfs(s, w, v, k, true)
	for i := range w {
		w[i] += '0'
	}
	return string(w)
}

func dfs(t []byte, w []byte, v []byte, k int, strict bool) bool {
	if k < 0 {
		return false
	}
	if len(t) == 0 {
		return true
	}
	var b byte
	if strict {
		b = t[0]
	}
	for i := b; i <= 9; i++ {
		w[0] = i
		o := 0
		if v[i] == 0 {
			o = 1
		}
		v[i]++
		if dfs(t[1:], w[1:], v, k-o, strict && i == t[0]) {
			return true
		}
		v[i]--
	}
	return false
}

package main

import (
	"bufio"
	//	"container/heap" for heap.Init()
	"fmt"
	"os"
	"runtime"
)

func check(b bool) {
	if !b {
		_, _, line, _ := runtime.Caller(1)
		fmt.Printf("check failed line %d\n", line)
		os.Exit(-1)
	}
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

type IntHeap []int

func (h IntHeap) Len() int            { return len(h) }
func (h IntHeap) Less(i, j int) bool  { return h[i] < h[j] }
func (h IntHeap) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *IntHeap) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

const (
	INIT = -1
)

var (
	k   int
	n   []int
	ans []int
)

// a >= b
func ge(a, b []int) bool {
	check(len(a) == len(b))
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			return a[i] > b[i]
		}
	}
	return true
}

func ok(a []int) bool {
	cnt := make([]int, 10)
	uniq := 0
	for i := 0; i < len(a); i++ {
		if cnt[a[i]] == 0 {
			uniq++
			if uniq > k {
				return false
			}
		}
		cnt[a[i]]++
	}
	return true
}

func toi(a []int) int {
	rv := 0
	for _, x := range a {
		rv *= 10
		rv += x
	}
	return rv
}

func gen(d int) []int {
	rv := make([]int, len(n))
	for i := 0; i < len(n); i++ {
		rv[i] = d
	}
	return rv
}

func can(a, b int) {
	for i := 0; i < len(n); i++ {
		if n[i] < b { // change after prefix of length i
			t := make([]int, len(n))
			copy(t, n)

			if n[i] < a {
				t[i] = a
			} else {
				t[i] = b
			}

			for j := i + 1; j < len(n); j++ {
				t[j] = a
			}

			// fmt.Printf("ans %v t %v ge %t\n", ans, t, ge(ans, t))
			if ge(ans, t) {
				copy(ans, t)
			}
		}

		if n[i] != a && n[i] != b { // prefix no longer valid
			return
		}

	}
}

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var tc int
	fmt.Fscan(r, &tc)

	for ; tc > 0; tc-- {

		var s string
		fmt.Fscan(r, &s, &k)
		n = make([]int, len(s))
		for i := 0; i < len(s); i++ {
			n[i] = int(s[i] - '0')
		}

		if ok(n) {
			fmt.Println(toi(n))
			continue
		}

		ans = gen(9)
		for i := 8; i > 0; i-- {
			t := gen(i)
			if ge(t, n) {
				ans = t
			}
		}

		if k > 1 {
			for a := 0; a < 9; a++ {
				for b := a + 1; b < 9; b++ {
					can(a, b)
				}
			}
		}

		fmt.Println(toi(ans))

	}
}