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, char smth2) {
- StringBuilder str = new StringBuilder();
- str.append(smth);
- for (int i = 0; i < str.length(); i++) {
- if (str.charAt(i) == smth2) {
- return i;
- }
- }
- return -1;
- }
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- String some_dumb = in.nextLine();
- char ch = in.nextLine().toCharArray()[0];
- System.out.print(everything(some_dumb, ch));
- }
- }
Add Comment
Please, Sign In to add comment