第一题:输入字符串长度len1,字符串s1,字符串长度len2,字符串s2。从后向前比较,以最短字符串为标准,输出不同的元素的个数。
例如: 输入:s1="1,3,5" len1=3 s2="2,4,1,7,5" len2=5
输出:1
函数原型
public int getDiffNum(int len1, String s1, int len2, String s2)
[java] :
public class HuaWeiTest {
public static void main(String[] args) {
String s1 = "1,3,5";
String s2 = "2,4,1,7,5";
int len1 = 3;
int len2 = 5;
HuaWeiTest hwt = new HuaWeiTest();
System.out.println(hwt.getDiffNum(len1, s1, len2, s2));
}
public int getDiffNum(int len1, String s1, int len2, String s2) {
int count = 0;
int len = 0;
String[] arr1 = s1.split(",");
String[] arr2 = s2.split(",");
if(len1 > len2) len = len2;
else len = len1;
for(int i=0;i
if(!arr1[len1-i-1].equals(arr2[len2-i-1])) {
count ++;
}
}
return count;
}
}
public class HuaWeiTest {
public static void main(String[] args) {
String s1 = "1,3,5";
String s2 = "2,4,1,7,5";
int len1 = 3;
int len2 = 5;
HuaWeiTest hwt = new HuaWeiTest();
System.out.println(hwt.getDiffNum(len1, s1, len2, s2));
}
public int getDiffNum(int len1, String s1, int len2, String s2) {
int count = 0;
int len = 0;
String[] arr1 = s1.split(",");
String[] arr2 = s2.split(",");
if(len1 > len2) len = len2;
else len = len1;
for(int i=0;i
if(!arr1[len1-i-1].equals(arr2[len2-i-1])) {
count ++;
}
}
return count;
}
}
第二题:输入字符串长度,字符串,计数m。从前往后计数,当数到m个元素时,m个元素出列,同时将该元素赋值给m,然后从下一个数计数循环,直到所有数字都出列,给定的数全部为大于0的数字。输出出队队列。
例如:输入:len=4 str="3,1,2,4" m=7
输出:2,3,1,4
函数原型
public String getOutString(int len, String str, int m)
[java] :
import java.util.ArrayList;
import java.util.List;
public class HuaWeiTest {
public static void main(String[] args) {
int len=4;
String str="3,1,2,4";
int m=7;
HuaWeiTest hwt = new HuaWeiTest();
System.out.println(hwt.getOutString(len, str, m));
}
public String getOutString(int len, String str, int m) {
String ret ="";
String[] arr = str.split(",");
List ls = new ArrayList();
for(int i=0;i
ls.add(arr[i]);
}
for(int i=0;i
int temp = (m-1)%ls.size();
ret += ls.get(temp);
m = Integer.parseInt(ls.get(temp))+temp;
ls.remove(temp);
}
return ret;
}
}
import java.util.ArrayList;
import java.util.List;
public class HuaWeiTest {
public static void main(String[] args) {
int len=4;
String str="3,1,2,4";
int m=7;
HuaWeiTest hwt = new HuaWeiTest();
System.out.println(hwt.getOutString(len, str, m));
}
public String getOutString(int len, String str, int m) {
String ret ="";
String[] arr = str.split(",");
List ls = new ArrayList();
for(int i=0;i
ls.add(arr[i]);
}
for(int i=0;i
int temp = (m-1)%ls.size();
ret += ls.get(temp);
m = Integer.parseInt(ls.get(temp))+temp;
ls.remove(temp);
}
return ret;
}
}
一.选秀节目打分,分为专家评委和大众评委,score[]数组里面存储每个评委打的分数,judge_type[]里存储与score[]数组对应的评委类别,judge_type[i] == 1,表示专家 评委,judge_type[i] == 2,表示大众评委,n表示评委总数。打分规则如下:专家评委和大众评委的分数先分别取一个平均分(平均分取整),然后,总分=专家评委平均分* 0.6 +大众评委* 0.4,总分取整。如果没有大众评委,则 总分=专家评委平均分,总分取整。函数最终返回选手得分。
函数接口int cal_score(int score[], int judge_type[], int n)
[java] :
public class SWTest {
public static void main(String[] args) {
int score[] = {
34,53,65,75,64
};
int judge_type[] = {
1,1,1,2,2
};
SWTest st = new SWTest();
System.out.print(st.cal_score(score, judge_type, 5));
}
int cal_score(int score[], int judge_type[], int n){
int totalExpert = 0;
int totalPublic = 0;
int numExpert = 0;
int numPublic = 0;
for(int i=0;i
if(judge_type[i]==1) {
totalExpert += score[i];
numExpert ++;
}
if(judge_type[i] == 2){
totalPublic += score[i];
numPublic ++;
}
}
if(0==numPublic){
return (int)totalExpert/numExpert;
}else
{
return (int)((totalExpert/numExpert)*0.6) +
(int)((totalPublic/numPublic)*0.4);
}
}
}
public class SWTest {
public static void main(String[] args) {
int score[] = {
34,53,65,75,64
};
int judge_type[] = {
1,1,1,2,2
};
SWTest st = new SWTest();
System.out.print(st.cal_score(score, judge_type, 5));
}
int cal_score(int score[], int judge_type[], int n){
int totalExpert = 0;
int totalPublic = 0;
int numExpert = 0;
int numPublic = 0;
for(int i=0;i
if(judge_type[i]==1) {
totalExpert += score[i];
numExpert ++;
}
if(judge_type[i] == 2){
totalPublic += score[i];
numPublic ++;
}
}
if(0==numPublic){
return (int)totalExpert/numExpert;
}else
{
return (int)((totalExpert/numExpert)*0.6) +
(int)((totalPublic/numPublic)*0.4);
}
}
}
二.给定一个数组input[],如果数组长度n为奇数,则将数组中最大的元素放到output[]数组最中间的位置,如果数组长度n为偶数,则将数组中最大的元素放到output[]数组中间两个位置偏右的那个位置上,然后再按从大到小的顺序,依次在第一个位置的两边,按照一左一右的顺序,依次存放剩下的数。 例如:input[] = {3, 6, 1, 9, 7} output[] = {3, 7, 9, 6, 1}; input[] = {3, 6, 1, 9, 7, 8} output[] = {1, 6, 8, 9, 7, 3}
函数接口void sort(int input[[, int n, int output[])
[java] :
public class SWTest {
public static void main(String[] args) {
int input[] = {3,6,1,9,7,8};
int output[] = new int[6];
SWTest st = new SWTest();
st.sort(input, 6, output);
for(int i=0;i
System.out.print(output[i]);
}
}
void sort(int input[], int n, int output[]){
for(int i=0;i
for(int j=n-1;j>i;j--){
if(input[j]>input[j-1]) {
int temp = input[j];
input[j] = input[j-1];
input[j-1] = temp;
}
}
}
int low = n/2-1;
int high = n/2+1;
output[n/2] = input[0];
for(int i=1;i
output[low] = input[i];
low --;
i++;
if(i == n) break;
output[high] = input[i];
high++;
i++;
}
}
}
public class SWTest {
public static void main(String[] args) {
int input[] = {3,6,1,9,7,8};
int output[] = new int[6];
SWTest st = new SWTest();
st.sort(input, 6, output);
for(int i=0;i
System.out.print(output[i]);
}
}
void sort(int input[], int n, int output[]){
for(int i=0;i
for(int j=n-1;j>i;j--){
if(input[j]>input[j-1]) {
int temp = input[j];
input[j] = input[j-1];
input[j-1] = temp;
}
}
}
int low = n/2-1;
int high = n/2+1;
output[n/2] = input[0];
for(int i=1;i
output[low] = input[i];
low --;
i++;
if(i == n) break;
output[high] = input[i];
high++;
i++;
}
}
}
三.操作系统任务调度问题。操作系统任务分为系统任务和用户任务两种。其中,系统任务的优先级 < 50,用户任务的优先级>= 50且<= 255。优先级大于255的为非法任务,应予以剔除。现有一任务队列task[],长度为n,task中的元素值表示任务的优先级,数值越小,优先级越高。函数scheduler实现如下功能,将task[]中的任务按照系统任务、用户任务依次存放到system_task[]数组和user_task[]数组中(数组中元素的值是任务在task[]数组中的下标),并且优先级高的任务排在前面,优先级相同的任务按照入 队顺序排列(即先入队的任务排在前面),数组元素为-1表示结束。 例如:task[] = {0, 30, 155, 1, 80, 300, 170, 40, 99} system_task[] = {0, 3, 1, 7, -1} user_task[] = {4, 8, 2, 6, -1}
函数接口void scheduler(int task[], int n, int system_task[], int user_task[])
[java] :
void scheduler(int task[], int n, int system_task[], int user_task[]){
int min = 0 ,s =0, u =0 ;
for(int i=0;i
min = 0;
for(int j=0;j
if(task[min]>task[j]) min = j;
}
if(task[min]<50) {
system_task[s++] = min;
}else if(task[min]<=255) {
user_task[u++] = min;
}
task[min] = 300;
}
system_task[s]= -1;
user_task[u] = -1;
}
void scheduler(int task[], int n, int system_task[], int user_task[]){
int min = 0 ,s =0, u =0 ;
for(int i=0;i
min = 0;
for(int j=0;j
if(task[min]>task[j]) min = j;
}
if(task[min]<50) {
system_task[s++] = min;
}else if(task[min]<=255) {
user_task[u++] = min;
}
task[min] = 300;
}
system_task[s]= -1;
user_task[u] = -1;
}
四.问题描述: 我国大陆运营商的手机号码标准格式为:国家码+手机号码,例如:8613912345678。特点如下: 1、长度13位; 2、以86的国家码打头; 3、手机号码的每一位都是数字。 请实现手机号码合法性判断的函数(注:考生无需关注手机号码的真实性,也就是说诸如86123123456789这样的手机号码,我们也认为是合法的),要求: 1)如果手机号码合法,返回0; 2)如果手机号码长度不合法,返回1 3)如果手机号码中包含非数字的字符,返回2; 4)如果手机号码不是以86打头的,返回3; 【注】除成功的情况外,以上其他合法性判断的优先级依次降低。也就是说,如果判断出长度不合法,直接返回1即可,不需要再做其他合法性判断。 要求实现函数: int s int verifyMsisdn(char* inMsisdn) 【输入】 char* inMsisdn,表示输入的手机号码字符串。 【输出】 无 【返回】 判断的结果,类型为int。 示例 输入: inMsisdn =“869123456789“ 输出: 无 返回: 1 输入: inMsisdn =“8813912345678“ 输出: 无 返回: 3 输入: inMsisdn =“8613912345678“ 输出: 无 返回: 0
[java] :
public class PhoneNumber {
public static void main(String[] args) {
String inMsisdn = "8613912345678";
System.out.println(new PhoneNumber().verifyMsisdn(inMsisdn));
}
int verifyMsisdn(String inMsisdn){
char[] inchars = inMsisdn.toCharArray();
if(inchars.length!=13) return 1;
for(int i=0;i<13;i++) {
if(!Character.isDigit(inchars[i])){
return 2;
}
}
if((Character.digit(inchars[0], 10)!=8 )||(Character.digit(inchars[1], 10)!=6) ) return 3;
else return 0;
}
}
试题一:输入字符串长度len1,字符串s1,字符串长度len2,字符串s2。从后向前比较,以最短字符串为标准,输出不同的元素的个数。
例如:输入:s1="1,3,5" len1=3 s2="2,4,1,7,5" len2=5
输出:1
public class Test1 {
public static void main(String[] args) {
String str1 = "1,3,5";
String str2 = "2,1,6,5";
System.out.println(getDifferentNumber(str1, 3, str2, 4));
}
public static int getDifferentNumber(String str1, int len1, String str2, int len2)
{
int count = 0;
int len = 0;
len = (len1
String s1[] = str1.split(",");
String s2[] = str2.split(",");
for(int i=0;i
{
if(!(s2[len2-i-1].equals(s1[len1-i-1])))
{
count++;
}
}
return count;
}
}
试题二:约瑟夫环问题。输入字符串长度,字符串,计数m。从前往后计数,当数到m个元素时,m个元素出列,然后将出列的数字赋值给m。然后从下一个数计数循环,直到所有数字都出列,给定的数全部为大于0的数字。输出出队队列。
public class Josephus_Seq {
public static void main(String[] args) {
Josephus jo = new Josephus(new int[]{3,1,6,2,5});
jo.ShowInfo();
System.out.println();
jo.doJosephus(3);
}
}
class Node
{
public int num;
public Node next;
public Node(int i)
{
this.num = i;
this.next = null;
}
}
class Josephus
{
public Node head;
public Josephus(int[] data)
{
Node p = new Node(data[0]);
head = p;
for(int i=1;i
{
p.next = new Node(data[i]);
p = p.next;
}
p.next = head;
}
public void doJosephus(int s)
{
Node p,q = null;
int step = s;
p = head;
while(p.next != p)
{
for(int i=1;i
{
q = p;
p = p.next;
}
step = p.num;
System.out.println(p.num);
q.next = p.next;
p = p.next;
}
}
}
试题三:手机号码判断问题
public class PhoneNumberTest {
public static void main(String[] args) {
PhoneNumberTest pt = new PhoneNumberTest();
int res = pt.verifyMsisdn("8662923042663");
System.out.println(res);
}
public int verifyMsisdn(String num)
{
int res = 0;
char[] ch = num.toCharArray();
if(ch.length<13)
return 1;
for(int i=0;i
{
if(!('0'<=ch[i]&&ch[i]<='9'))
return 2;
}
if(!((ch[0]=='8')&&(ch[1]=='6')))
return 3;
return res;
}
}
试题四:使用数组和链表实现数据结构-栈。
//数组实现
public class MyStack {
private Object[] obj = new Object[16];
private int size = 0;
public boolean isEmpty()
{
return size==0;
}
public void clear()
{
for(int i=0;i
{
obj[i] = null;
}
size = 0;
}
public int lentgh()
{
return size;
}
private void resize()
{
Object[] temp = new Object[obj.length*3/2+1];
for(int i=0;i
{
temp[i] = obj[i];
obj[i] = null;
}
obj = temp;
}
public boolean push(Object data)
{
if(size>=obj.length)
{
resize();
}
obj[size++] = data;
return true;
}
public Object pop()
{
if(size == 0)
{
return null;
}
return obj[--size];
}
}
实例应用1:将10进制的正整数转换为n进制
public String conversion(int num,int n)
{
MyStack ms = new MyStack();
Integer res = num;
while(true)
{
ms.push(res%n);
res = res/n;
if(res == 0)
{
break;
}
}
StringBuffer sb =new StringBuffer();
while((res=(Integer) ms.pop())!=null)
{
sb.append(res);
}
return sb.toString();
}
实例应用2:判断括号的匹配
public boolean isMatch(String str) {
MyStack myStack = new MyArrayStack();
char[] arr = str.toCharArray();
for (char c : arr) {
Character temp = myStack.pop();
// 栈为空时只将c入栈
if (temp == null) {
myStack.push(c);
}
// 配对时c不入栈
else if (temp == '[' && c == ']') {
}
// 配对时c不入栈
else if (temp == '(' && c == ')') {
}
// 不配对时c入栈
else {
myStack.push(temp);
myStack.push(c);
}
}
return myStack.isEmpty();
}
//链表实现
public class MyLinkedStack {
private LinkedNode top;
private int size;
public MyLinkedStack()
{
top = null;
size = 0;
}
public boolean isEmpty()
{
return size == 0;
}
public void clear()
{
top = null;
size = 0;
}
public int length()
{
return size;
}
public boolean push(Object o)
{
LinkedNode ln = new LinkedNode();
ln.data = o;
ln.pre = top;
top = ln;
size++;
return true;
}
public Object pop()
{
if(top != null)
{
LinkedNode ln = top;
top = top.pre;
size--;
return ln.data;
}
return null;
}
}
class LinkedNode
{
public Object data;
public LinkedNode pre;
}
试题五:简单四则运算
public class Operate {
public static void main(String[] args) {
String exp = "1+3*4+6/2";
System.out.println(calculate(exp));
}
public static int calculate(String exp)
{
char[] exps = exp.toCharArray();
int[] num = new int[20];
int[] str = new int[20];
int k2;
int k1 = k2 = 0;
for(int i=0;i
{
if(exps[i]>='0'&&exps[i]<='9')
{
num[k1++] = exps[i]-'0';
}
if(exps[i]=='-'||exps[i]=='+')
{
str[k2++] = exps[i];
}
if(exps[i]=='*')
{
num[k1-1] = num[k1-1]*(exps[i+1]-'0');
i++;
}
if(exps[i]=='/')
{
num[k1-1] = num[k1-1]/(exps[i+1]-'0');
i++;
}
}
for(int i=0;i
{
System.out.print(num[i]);
}
System.out.println();
for(int i=0;i
{
System.out.print(str[i]);
}
System.out.println();
int temp = num[0];
int j = 0;
while(j
{
if(str[j]=='-')
temp = temp - num[j+1];
else if(str[j]=='+')
temp = temp + num[j+1];
j++;
}
return temp;
}
}
试题六:判断回文字符
public class HuiwenArrayTest {
public static void main(String[] args) {
int[] a = new int[]{1,2,2,1};
System.out.println(HuiwenArrayTest.judge(a));
}
public static boolean judge(int[] array)
{
for(int i=0;i
{
if(array[i] == array[array.length-1-i])
{
continue;
}
else
return false;
}
return true;
}
}
试题七:求两个数组的异集(A和B的交集)
public static void start(Integer[] a, Integer[] b)
{
List list = new ArrayList();
for(int i=0;i
{
for(int j=0;j
{
if(b[j] == a[i])
{
list.add(a[i]);
break;
}
}
}
System.out.println(list);
}
}
试题八:逆序链表
非递归实现:
public void reverse()
{
MyTestNode pre = null,post = null;
MyTestNode p = head;
while(p.next!=null)
{
post = p.next;
if(post == null)
{
head = post;
}
p.next = pre;
pre = p;
p = post;
}
p.next = pre;
head = p;
}
试题九:一副牌中发五张扑克牌给你:让你判断数字的组成:有以下几种情况: 1:四条:即四张一样数值的牌(牌均不论花色)2:三条带一对 3:三条带两张不相同数值的牌4:两对5:顺子包括10,J,Q,K,A 6:什么都不是7:只有一对
public class Puke {
public static void main(String[] args) {
int[] a = new int[]{1,2,3,4,5};
start(a);
}
public static void start(int a[])
{
for(int i=0;i
{
for(int j=i+1;j
{
int tmp = 0;
if(a[i]>a[j])
{
tmp = a[i];
a[i] = a[j];
a[j] = tmp;
}
}
}
int k = 0;
for(int i=0;i<4;i++)
{
if(a[i]==a[i+1])
k++;
}
if(k==3)
{
if(a[0]==a[3])
System.out.println("四条");
else
System.out.println("三条带一对");
}
if(k==2)
{
if(a[1]!=a[2]||a[2]!=a[3])
System.out.println("三条带两个不同的");
else
System.out.println("两对");
}
if(k==1)
System.out.println("一对");
if(k==0){
if(a[4]-a[0]==4&&a[4]-a[1]==3&&a[4]-a[2]==2&&a[4]-a[3]==1)
System.out.println("顺子");
else
System.out.println("什么都不是");
}
}
}
试题十:选秀节目打分,分为专家评委和大众评委,score[]数组里面存储每个评委打的分数,judge_type[]里存储与score[]数组对应的评委类别,judge_type == 1,表示专家评委,judge_type == 2,表示大众评委,n表示评委总数。打分规则如下:专家评委和大众评委的分数先分别取一个平均分(平均分取整),然后,总分=专家评委平均分* 0.6 +大众评委* 0.4,总分取整。如果没有大众评委,则 总分=专家评委平均分,总分取整。函数最终返回选手得分。
public class Mark {
public static void main(String[] args) {
int[] a = new int[]{20,10,40,50};
int[] b = new int[]{1,2,1,2};
System.out.println(new Mark().doMark(a, b));
}
public int doMark(int[] score,int[] s)
{
int result = 0;
int dazhong = 0;
int zhuanye = 0;
int total = 0;
for(int i=0;i
{
total+=s[i];
}
if(total==score.length)
{
for(int i=0;i
{
zhuanye+=score[i];
}
result = zhuanye/score.length;
}
else
{
int tmpa=0;
int tmpb=0;
for(int i=0;i
{
if(s[i]==1)
{
dazhong+=score[i];
tmpa++;
}
else if(s[i]==2)
{
zhuanye+=score[i];
tmpb++;
}
}
System.out.println(dazhong);
System.out.println(zhuanye);
result = (int) (dazhong/tmpa*0.4 + zhuanye/tmpb*0.6);
}
return result;
}
}
试题十一:给定一个数组input[],如果数组长度n为奇数,则将数组中最大的元素放到output[]数组最中间的位置,如果数组长度n为偶数,则将数组中最大的元素放到output[]数组中间两个位置偏右的那个位置上,然后再按从大到小的顺序,依次在第一个位置的两边,按照一左一右的顺序,依次存放剩下的数。
public class ArrayTest {
public static void main(String[] args) {
int[] input = new int[]{3,6,1,9,7,8};
int[] output = new int[]{0,0,0,0,0,0};
arrange(input, output);
}
public static void arrange(int[] input,int[] output)
{
//首先冒泡排序
for(int i=0;i
{
for(int j=i+1;j
{
int tmp = 0;
if(input[i]
{
tmp = input[i];
input[i] = input[j];
input[j] = tmp;
}
}
}
//根据题目要求进行分配
output[output.length/2] = input[0];
int left = 0;
int right = 0;
for(int i=1;i
{
if(!(i%2 == 0))
{
left++;
System.out.println(output.length/2-left+":"+input[i]);
output[output.length/2-left] = input[i];
}
else if(i%2 == 0)
{
right++;
System.out.println(output.length/2-left+":"+input[i]);
output[output.length/2+right] = input[i];
}
}
for(int i=0;i
{
System.out.print(output[i]);
}
}
}
试题十二:操作系统任务调度问题。操作系统任务分为系统任务和用户任务两种。其中,系统任务的优先级 < 50,用户任务的优先级>= 50且<= 255。优先级大于255的为非法任务,应予以剔除。现有一任务队列task[],长度为n,task中的元素值表示任务的优先级,数值越小,优先级越高。函数scheduler实现如下功能,将task[]中的任务按照系统任务、用户任务依次存放到system_task[]数组和user_task[]数组中(数组中元素的值是任务在task[]数组中的下标),并且优先级高的任务排在前面,数组元素为-1表示结束。
public class Task {
public static void main(String[] args) {
int[] task = new int[]{24,56,12,78,23,6,234};
doTask(task);
}
public static void doTask(int[] task)
{
int[] tempTask = new int[task.length];
for(int i=0;i
{
tempTask[i] = task[i];
}
for(int i=0;i
{
System.out.print(" "+tempTask[i]);
}
for(int i=0;i
{
int tmp = 0;
for(int j=i+1;j
{
if(task[i]
{
tmp = task[i];
task[i] = task[j];
task[j] = tmp;
}
}
}
System.out.println();
for(int i=0;i
{
System.out.print(" "+task[i]);
}
//查找
int[] index = new int[task.length];
for(int i=0;i
{
for(int j=0;j
{
if(task[i] == tempTask[j])
index[i] = j;
}
}
System.out.println();
//执行分发
List sys_List = new ArrayList();
List usr_List = new ArrayList();
for(int i=0;i
{
if(50>task[i])
sys_List.add(index[i]);
else if(task[i]>=50&&task[i]<=255)
usr_List.add(index[i]);
}
sys_List.add(-1);
usr_List.add(-1);
System.out.println(sys_List);
System.out.println(usr_List);
}
}
试题十三:将一个字符串的元音字母复制到另一个字符串,并排序(30分)
问题描述:有一字符串,里面可能包含英文字母(大写、小写)、数字、特殊字符,现在需要实现一函数,将此字符串中的元音字母挑选出来,存入另一个字符串中,并对字符串中的字母进行从小到大的排序(小写的元音字母在前,大写的元音字母在后,依次有序)。
说明:1、 元音字母是a,e,i,o,u,A,E,I,O,U。2、 筛选出来的元音字母,不需要剔重;
最终输出的字符串,小写元音字母排在前面,大写元音字母排在后面,依次有序。
public class StrTest {
public static void main(String[] args) {
System.out.println(doSomething("adskjflssiAUIOWESLJFIOowfilk"));
}
public static String doSomething(String str)
{
StringBuffer sb = new StringBuffer();
char[] ch = str.toCharArray();
for(int i=0;i
{
if(ch[i]=='a'||ch[i]=='e'||ch[i]=='i'||ch[i]=='o'||ch[i]=='u'
||ch[i]=='A'||ch[i]=='E'||ch[i]=='I'||ch[i]=='O'||ch[i]=='U')
{
sb.append(ch[i]);
}
}
char[] tmpch = sb.toString().toCharArray();
StringBuffer small = new StringBuffer();
StringBuffer big = new StringBuffer();
for(int i=0;i
{
if(tmpch[i]>='a'&&tmpch[i]<='u')
{
small.append(tmpch[i]);
}
else
big.append(tmpch[i]);
}
char[] chsmal = small.toString().toCharArray();
char[] chbig = big.toString().toCharArray();
for(int i=0;i
{
char tmp = ' ';
for(int j=i+1;j
{
if(chsmal[j]
{
tmp = chsmal[j];
chsmal[j] = chsmal[i];
chsmal[i] = tmp;
}
}
}
for(int i=0;i
{
char tmp = ' ';
for(int j=i+1;j
{
if(chbig[j]
{
tmp = chbig[j];
chbig[j] = chbig[i];
chbig[i] = tmp;
}
}
}
//Arrays.sort(chsmal);
char[] total = new char[sb.length()];
for(int i=0;i
{
total[i] = chsmal[i];
}
for(int i=0;i
{
total[chsmal.length+i] = chbig[i];
}
return String.valueOf(total);
}
}