//字符串反转package main import "fmt" func reverse(str string) string { var result string strLen := len(str) ; i < strLen; i++ { result = result + fmt.Sprintf(]) } return result } func reverse1(str string) string { var result []byte tmp := []byte(…
Given two binary strings, return their sum (also a binary string). For example,a ="11"b ="1"Return"100". 思路很简单,先把短的字符串补齐,然后逐位相加. string addBinary(string a, string b) { int length = max(a.size(), b.size()); , ' '); '; while (l…
字符串操作 name = "alex" print(name.capitalize()) #首字母大写 name = "my name is alex" print(name.count("a")) #统计字母"a"的数量 print(name.center(50,"-")) #一共打印50个字符,变量name在中间,其余用"-"补足 print(name.endswith("…
using System; using System.Collections.Generic; using System.Text; using System.Collections; using System.Text.RegularExpressions; using System.Security.Cryptography; /**/ //////////////////////////////////////////////////// ///功能:字符文本操作类 /// /// ///…
A. Beru-taxi time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy lives at point (a, b) of the coordinate plane. He is hurrying up to work so he wants to get out of his house as soon as…