#include<iostream>
#include<string>using namespace std;
void InverseStr(string &str)
{ int len=str.length(); char temp; for(int i=0;i<len/2;i++) { temp=str[i]; str[i]=str[len-i-1]; str[len-i-1]=temp; }}int main()
{ string str; cout<<"input"<<endl; cin>>str; InverseStr(str); cout<<str<<endl; return 0;} 冒泡法排序void bubble(int[] nums)
{ int i,j,temp,len; len=nums.length; for(i=0;i<=len-1;i++) { for(j=0;j<=len-i-1;j++) { if(nums[j]>=nums[j+1]) { temp=nums[j]; nums[j]=nums[j+1]; nums[j+1]=temp; } } }} 二分查找法public static int BiSearch(int[] nums,key)
{ int len=nums.length; int start=0; int end=len-1; while(end>start) { mid=(start+mid)/2; if(nums[mid]=key) { return mid; } else if(nums[mid]>key) { end=mid-1; }else { start=mid+1; } } return -1;}