Hackerrank Reverse
Hackerrank Reverse
java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
public class Solution {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int a = s.nextInt();
int b = s.nextInt();
int c = s.nextInt();
// int d= (b-a)+1;
int k = 0;
int sum=0;
while(k<4){
int r=0;
int z=a;
while(a != 0) {
// get last digit from num
int digit = a % 10;
r = r * 10 + digit;
// remove the last digit from num
a /= 10;
}
double h = (z-r)/c;
double check= Math.round(h);
if( check==h){
sum=sum+1;
}
else{
sum=sum+0;
}
z++;
k++;
}
System.out.println(sum);
}
}
public class Solution {
public static void main(String[] args) {
Scanner s= new Scanner(System.in); //System.in is a standard input str
eam
//System.out.print("Enter a string: ");
String str= s.nextLine();
long n = s.nextLong();
long length=str.length();
double t=n%length;
int p=(int)t;
//System.out.println(t);
long e=n/length;
// System.out.println(e);
char someChar = 'a';
//char c = sc.next().charAt(0);
int count = 0;
int remain=0;
for (int i = 0; i < str.length(); i++) {
int te=str.charAt(i);
if (str.charAt(i) == someChar) {
count++;
}
if (te>t){
remain++;
}
}
if(t!=0){
long g=(e*count)+remain;
//long g=gl;
System.out.println(g);
}
else{
long y=e*count;
//long y=yl;
System.out.println(y);
}
}