{"id":"68bd5fa3-8848-44df-8f84-25de11517488","name":"Check Divisibility By 3","description":"1. You are given a binary string which represents a number.\r\n2. You have to check whether this number is divisible by 3 or not.\r\n3. Print 'true' if it is divisible by 3, otherwise print 'false'.","inputFormat":"A binary string","outputFormat":"true or false","constraints":"1 &lt;= length of binary string &lt;= 10000","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\nint main(){\n string str;\n cin>>str;\n \n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args){\r\n Scanner scn = new Scanner(System.in);\r\n String str = scn.nextLine();\r\n\r\n //write your code here\r\n }\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"10010101010001","sampleOutput":"false\r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"f3e3dbef-d2b7-4f6d-b357-2ef3738e6c91","name":"Bit Manipulation For Intermediate","slug":"bit-manipulation-for-intermediate-9995","type":0},{"id":"df7a45e0-2d3a-4e7e-94bc-d607b04651cf","name":"Check Divisibility By 3","slug":"check-divisibility-by-3","type":1}],"next":{"id":"4008bf78-48f8-447d-ada8-8537aa8897b5","name":"Check Divisibility by 3 MCQ","type":0,"slug":"check-divisibility-by-3-mcq"},"prev":{"id":"cbe4190f-a551-4342-a089-4e47dd3c2e36","name":"Sum Of Bit Differences Of All Pairs","type":3,"slug":"sum-of-bit-differences-of-all-pairs"}}}

Check Divisibility By 3

1. You are given a binary string which represents a number. 2. You have to check whether this number is divisible by 3 or not. 3. Print 'true' if it is divisible by 3, otherwise print 'false'.

{"id":"68bd5fa3-8848-44df-8f84-25de11517488","name":"Check Divisibility By 3","description":"1. You are given a binary string which represents a number.\r\n2. You have to check whether this number is divisible by 3 or not.\r\n3. Print 'true' if it is divisible by 3, otherwise print 'false'.","inputFormat":"A binary string","outputFormat":"true or false","constraints":"1 &lt;= length of binary string &lt;= 10000","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\nint main(){\n string str;\n cin>>str;\n \n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args){\r\n Scanner scn = new Scanner(System.in);\r\n String str = scn.nextLine();\r\n\r\n //write your code here\r\n }\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"10010101010001","sampleOutput":"false\r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"f3e3dbef-d2b7-4f6d-b357-2ef3738e6c91","name":"Bit Manipulation For Intermediate","slug":"bit-manipulation-for-intermediate-9995","type":0},{"id":"df7a45e0-2d3a-4e7e-94bc-d607b04651cf","name":"Check Divisibility By 3","slug":"check-divisibility-by-3","type":1}],"next":{"id":"4008bf78-48f8-447d-ada8-8537aa8897b5","name":"Check Divisibility by 3 MCQ","type":0,"slug":"check-divisibility-by-3-mcq"},"prev":{"id":"cbe4190f-a551-4342-a089-4e47dd3c2e36","name":"Sum Of Bit Differences Of All Pairs","type":3,"slug":"sum-of-bit-differences-of-all-pairs"}}}
plane

Editor


Loading...

Check Divisibility By 3

easy

1. You are given a binary string which represents a number. 2. You have to check whether this number is divisible by 3 or not. 3. Print 'true' if it is divisible by 3, otherwise print 'false'.

Constraints

1 <= length of binary string <= 10000

Format

Input

A binary string

Output

true or false

Example

Sample Input

10010101010001

Sample Output

false

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode