/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner input = new Scanner(System.in);
String number = input.nextLine();
String sub;
int length=number.length();
int i=0;
for(int first=0;first<length;first++)
{
for(int second=first+1;second<=length;second++)
{
sub = number.substring(first,second);
int a = Integer.parseInt(sub);
if((a%7)==0)
{
i++;
}
}
}
System.out.println(i);
}
}
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner input = new Scanner(System.in);
String number = input.nextLine();
String sub;
int length=number.length();
int i=0;
for(int first=0;first<length;first++)
{
for(int second=first+1;second<=length;second++)
{
sub = number.substring(first,second);
int a = Integer.parseInt(sub);
if((a%7)==0)
{
i++;
}
}
}
System.out.println(i);
}
}
Comments
Post a Comment