Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class test3 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- char[] word={'a','b','c','d','e','f',
- 'g','h','i','j','k','l',
- 'm','n','o','p','q','r',
- 's','t','u','v','w','x',
- 'y','z'};
- int[] wordInt = new int[26];
- String str1 = sc.nextLine().toLowerCase();
- String str2 = sc.nextLine().toLowerCase();
- for(int i =0 ; i<str1.length();i++){
- for(int j=0 ; j<str2.length();j++){
- if( str1.charAt(i) == str2.charAt(j) ){
- for(int k =0 ; k<26 ; k++){
- if(word[k] == str1.charAt(i))
- wordInt[k]++;
- }
- }
- }
- }
- for(int i = 0 ; i<26;i++){
- if(wordInt[i]>=1)
- System.out.printf("%c",word[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement