Skip to content
Programmingoneonone
Programmingoneonone
  • Engineering Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
    • 100+ C++ Programs
  • Solutions
    • HackerRank
      • Algorithms Solutions
      • C solutions
      • C++ solutions
      • Java solutions
      • Python solutions
    • Leetcode Solutions
    • HackerEarth Solutions
  • Work with US
Programmingoneonone
Programmingoneonone

HackerEarth What is the string made of? problem solution

YASH PAL, 31 July 202410 February 2026
In this HackerEarth What is the string made of? problem solution You are given a string, which contains entirely decimal digits (0-9). Each digit is made of a certain number of dashes, as shown in the image below. For instance, 1 is made of 2 dashes, 8 is made of 7 dashes, and so on.
You have to write a function that takes this string message as an input and returns a corresponding value in terms of a number. This number is the count of dashes in the string message.
HackerEarth What is the string made of? problem solution

HackerEarth What is the string made of problem solution.

a = raw_input()
ans = 0
for i in a:
    if i == '0':
        ans += 6
    if i == '1':
        ans += 2
    if i == '2':
        ans += 5
    if i == '3':
        ans += 5
    if i == '4':
        ans += 4
    if i == '5':
        ans +=5
    if i == '6':
        ans += 6
    if i == '7':
        ans += 3
    if i == '8':
        ans += 7
    if i == '9':
        ans += 6
print ans
coding problems solutions

Post navigation

Previous post
Next post

Programmingoneonone

We at Programmingoneonone, also known as Programming101 is a learning hub of programming and other related stuff. We provide free learning tutorials/articles related to programming and other technical stuff to people who are eager to learn about it.

Pages

  • About US
  • Contact US
  • Privacy Policy

Practice

  • Java
  • C++
  • C

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes