Yaroslavovich

Untitled

Dec 3rd, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1.  import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.      StringBuilder Zzz = new StringBuilder();
  6.      Scanner in = new Scanner(System.in);
  7.      String Stroka= in.nextLine();
  8.      char b = in.next().charAt(0);
  9.      boolean bl = false;
  10.      for(int i =0;i<Stroka.length();i++) {
  11.          if(Stroka.charAt(i)==b){
  12.              System.out.println(i);
  13.              bl = true;
  14.              break;
  15.          }
  16.         }
  17.         if (!bl) {
  18.             System.out.println(-1);
  19.         }
  20.  
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment