public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(func("silent", "listen"))
System.out.println(func("", ""))
}
public static boolean func(String str1, String str2) {
char[] arr1 = str1.toCharArray()
char[] arr2 = str2.toCharArray()
Arrays.sort(arr1)
Arrays.sort(arr2)
for(int i = 0i <arr1.lengthi++) {
if(arr1[i] != arr2[i]) {
return false
}
}
return true
}
}
#include<stdio.h>
#include<ctype.h>
int main()
{int a[26]={0}
char c
int i
while(1)
{ scanf("%c",&c)
if(c=='\n')break
if(isalpha(c))a[tolower(c)-'a']++
}
while(1)
{ scanf("%c",&c)
if(c=='\n')break
if(isalpha(c))a[tolower(c)-'a']--
}
c='y'
for(i=0i<26i++)
if(a[i])c='n'
printf("%c\n",c)
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)