题解 | #字符串字符匹配#
字符串字符匹配
http://www.nowcoder.com/practice/22fdeb9610ef426f9505e3ab60164c93
import java.util.; import java.io.; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str = null; while((str = in.readLine()) != null){ Set set = new HashSet<>(); String temp = in.readLine(); for(int i = 0;i < temp.length();i++){ if(!set.contains(temp.charAt(i))){ set.add(temp.charAt(i)); } } int flag = 0; for(int i = 0;i < str.length();i++){ if(!set.contains(str.charAt(i))){ flag = 1; break; } } if(flag == 0){ System.out.println(true); }else{ System.out.println(false); } } } }
我居南半坡 文章被收录于专栏
多刷题,积蓄力量,欢迎讨论