Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
ddd
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.Scanner; import java.util.TreeSet; public class A{ public static void main(String []args){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t>0) { int a,b; a=sc.nextInt(); b=sc.nextInt(); TreeSet<Character> t1=new TreeSet<Character>(); String s1=sc.nextLine(); String s2=sc.nextLine(); char[] c1=s1.toCharArray(); char[] c2=s2.toCharArray(); for(int i=0;i<a;i++) { for(int j=0;j<b;j++) { if(c1[i]==c2[j]) { t1.add(c1[i]); } } } System.out.println(t1.size()); } } }
run
|
edit
|
history
|
help
0
K closest points
Java Lambda Expression Sample
Length of longest substring
test1
Sorting array
brindtuch
Problem: on_off
Item battle rolyal
상속1
Ifelsenested