private static void f(String s1, String s2, boolean[] b, char c, String str){
//		System.out.print(str);
		
		while (true){
			boolean flag = true;
			for (int i = 0 ; i < s1.length();i++){
				if (b[i]== true) {
					
					if (s1.charAt(i) == c){						
						char c_backup = c;
						str += c;
						c = s2.charAt(i);
						flag = false;
						b[i] = false;
						
						String str_backup = str.substring(0);
						
						f(s1, s2, b, c, str);
						
						str = str.substring(0, str_backup.length() - 1);
						c = c_backup;
						flag = true;
						b[i] = true;
					}
				}
			}
			
			if (flag == true) break;
				
		}
		
		if (str.length() == 31){
			boolean exist = false;
			for (int i=1; i <= result.size(); i++){
				if (str.equals(result.get(i - 1))){
					exist = true;
					break;
				}
			}
			if (exist == false){
				System.out.println(str);
				result.add(str);
			}
			
		}
			
	}