Java Scanner Usage common(Scanner in)

Here you can find the source of common(Scanner in)

Description

common

License

Open Source License

Declaration

private static String common(Scanner in) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Scanner;

public class Main {
    private static String common(Scanner in) {
        String a = in.nextLine();
        String b = in.nextLine();
        boolean[] marked = new boolean[26];
        for (char c : a.toCharArray()) {
            int pos = c - 97;
            marked[pos] = true;/*  w w w  .ja va2  s.c  o  m*/
        }

        for (char c : b.toCharArray()) {
            int pos = c - 97;
            if (marked[pos]) {
                return "YES";
            }
        }
        return "NO";
    }
}

Related

  1. asList(String source, String separator)
  2. calcCompileWarnings(String compilerResult)
  3. cleanUpEmptyLinesAndIndent(String input)
  4. close()
  5. computeSumTable(Scanner in, short n)
  6. confirm(String message)
  7. confirm(String message)
  8. confirmAction(String warning)