早岁已知世事艰


私信TA

用户名:dotcpp0644324

访问量:160

签 名:

仍许飞鸿荡云间

等  级
排  名 247
经  验 5844
参赛次数 0
文章发表 5
年  龄 99
在职情况 学生
学  校 猪鼻巴巴大学
专  业

  自我简介:

TA的其他文章

解题思路:

注意事项:

参考代码:


import java.util.*;

import java.math.*;

public class Main{

static Scanner sc=new Scanner(System.in);

public static void main(String[]args) {

String str=sc.nextLine();

String s[]=str.split(" ");

char c[][]=new char[s.length][100];

for(int i=0;i<s.length;i++) {

c[i]=s[i].toCharArray();

Arrays.sort(c[i]);

}

String str1=sc.nextLine();

String s1[]=str1.split(" ");

char c1[][]=new char[s1.length][100];

for(int i=0;i<s1.length;i++) {

c1[i]=s1[i].toCharArray();

Arrays.sort(c1[i]);

}

for(int i=0;i<c.length;i++) {

for(int j=0;j<c1.length;j++) {

if(c[i].length==c1[j].length) {

boolean wet=true;

for(int k=0;k<c1[j].length;k++) {

if(c[i][k]!=c1[j][k]) {

wet=false;

}

}

if(wet==true) {

System.out.print(s[i]+" ");

}

}

}

}

}

}



 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区