Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- import java.util.Random;
- public class Main {
- public static int everything(String smth, String smth2) {
- int k = 0;
- StringBuilder str = new StringBuilder();
- str.append(smth);
- StringBuilder str2 = new StringBuilder();
- str2.append(smth2);
- for (int i = 0; i < str.length(); i++) {
- if (smth.charAt(i) == smth2.charAt(0)) {
- for (int j = 0; j < str2.length(); j++) {
- if (smth.charAt(i) == smth2.charAt(j)) {
- }
- else {
- break;
- }
- k++;
- }
- }
- }
- return k;
- }
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- String str = in.nextLine();
- String str2 = in.nextLine();
- System.out.println(everything(str, str2));
- }
- }
Add Comment
Please, Sign In to add comment