what-is-the-string-made-of-2

You are given a string, which contains entirely of 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.

Note:

0 consists of 6 dashes, 1 consists of 2 dashes, 2 consists of 5 dashes, 3 consists of 5 dashes, 4 consists of 4 dashes, 5 consists of 5 dashes, 6 consists of 6 dashes, 7 consists of 3 dashes [though the figure shows that 7 consists of 4 dashes but due to minor mistake in the problem please write your solution assuming 7 consists of 3 dashes], 8 consists of 7 dashes, 9 consists of 6 dashes.

Constraints
String message will contain at least one digit, but not more than 100
Each character in code will be a digit ('0'-'9').

SAMPLE INPUT
12134

SAMPLE OUTPUT
18

Source: hackerearth | Difficulty: EASY
Tags: Fundamentals

Ad-hoc


Solutions:
N=(input())
dict={'0':6,'1':2,'2':5,'3':5,'4':4,'5':5,'6':6,'7':3,'8':7,'9':6}
a=list(N)
b=0
for i in a:
	b=b+dict[i]
print(b)


#!/usr/bin/python
dict = {'0':6,'1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6,'7':3,'8':7,'9':6}
x = (input(""))
str_dashes = 0
for i,c in enumerate(x):
	str_dashes+=dict[c]
print(str_dashes);


stri=input()
val="6255456376"
sum=0
for i in range(0,len(stri)):
	sum+=int(val[int(stri[i])])
print(sum)


d = {'1': 2, '2': 5,'3':5,'4':4,'5':5,'6':6,'7':3,'8':7,'9':6,'0':6};
c=0
n=input();
for p in n:
	c+=d[p]
print(c)
		


no_map = {"0": 6,"1":2, "2":5, "3":5, "5":5, "4":4, "6":6, "7":3, "8":7, "9":6}
no = input()
s = 0
for i in no:
	s+=no_map[i]
print(s)
	
	


import sys
numbers=dict()
numbers={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6,0:6}
t=input()
total=0
for i in t:
	if int(i) in numbers:
		total=total+numbers[int(i)]
		
print(total)
		


#!/usr/bin/python

def input():
	string=list(input())
	string=list(map(int,string))
	count(string)

def count(string):
	count = 0
	dashes={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6,0:6}
	for i in string:
		count = count + dashes[i]
	print(count)

eval(input())


c=0
a=input()
for j in range(len(a)):
	if a[j]=='1':
	    c=c+2
	elif a[j]=='2':
	    c=c+5
	elif a[j]=='3':
	    c=c+5
	elif a[j]=='4':
	    c=c+4
	elif a[j]=='5':
	    c=c+5
	elif a[j]=='6':
	    c=c+6
	elif a[j]=='7':
	    c=c+3
	elif a[j]=='8':
	    c=c+7
	elif a[j]=='9':
	    c=c+6
	elif a[j]=='0':
	    c=c+6
print(c)
    


dict={'0':6,'1':2,'2':5,'3':5,'4':4,'5':5,'6':6,'7':3,'8':7,'9':6}
x=input()
ans=0
for i in x:
	ans+=dict[i]
print(ans)


s=input()
c=0
for i in range(0,len(s)):
	if(s[i]=="1"):
		c+=2
	if(s[i]=="2" or s[i]=="3" or s[i]=="5"):
		c+=5
	if(s[i]=="4"):
		c+=4
	if(s[i]=="6" or s[i]=="9" or s[i]=="0"):
		c+=6
	if(s[i]=='8'):
		c+=7
	if(s[i]=='7'):
		c+=3
print(c)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
digits = '0123456789'
dash = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dashes = {digits[i]: dash[i] for i in range(len(digits))}
print((sum([dashes[i] for i in input()])))


dashes={'0':6,'1':2,'2':5,'3':5,'4':4,'5':5,'6':6,'7':3,'8':7,'9':6}
n = input()
s=0
for e in n:
	s+=dashes[e]
print(s)


n = input()
sum = 0

for i in n:
	if int(i) == 0 or int(i) == 6 or int(i)==9:
		sum += 6
	elif int(i)==1:
		sum += 2
	elif int(i)==2 or int(i)==3 or int(i)==5:
		sum += 5
	elif int(i)==4:
		sum += 4
	elif int(i) ==7:
		sum += 3
	elif int(i) == 8:
		sum += 7

print(sum)





'''
# Read input from stdin and provide input before running code

#name = raw_input('What is your name?\n')
#print 'Hi, %s.' % name
#'''
#print 'Hello World!'
string=input()
sum=0
i=0
for i in string:
	if i=='1':
		sum+=2
	elif i=='2':
		sum+=5
	elif i=='3':
		sum+=5
	elif i=='4':
		sum+=4
	elif i=='5':
		sum+=5
	elif i=='6':
		sum+=6
	elif i=='7':
		sum+=3
	elif i=='8':
		sum+=7
	elif i=='9':
		sum+=6
	elif i=='0':
		sum+=6
print(sum)


dashes={'0':6,'1':2,'2':5,'3':5,'4':4,'5':5,'6':6,'7':3,'8':7,'9':6}
n = input()
s=0
for e in n:
	s+=dashes[e]
print(s)


N = input()
dash_dict = {'0':6, '1':2, '2':5, '3':5, '4':4, '5':5, '6':6, '7':3, '8':7, '9':6}
count = 0
for i in N:
	count += dash_dict[i]
print(count)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
from functools import reduce
def char2num(s):
	return {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}[s]

def str2int(s):
	return reduce(lambda x,y: x+y, list(map(char2num, s)))

st=input()
print(str2int(st))


n = list(map(int,str((input()))))

sum = 0
for i in range(0,len(n)):

	if n[i] == 0:
		sum += 6
	elif n[i] == 1:
		sum += 2
	elif n[i] == 2:
		sum += 5
	elif n[i] == 3:
		sum += 5
	elif n[i] == 6:
		sum += 6
	elif n[i] == 4:
		sum += 4
	elif n[i] == 5:
		sum += 5
	elif n[i] == 7:
		sum += 3
	elif n[i] == 8:
		sum += 7
	elif n[i] == 9:
		sum += 6

print(sum)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
l={'1':2,'2':5,'3':5,'4':4,'5':5,'6':6,'7':3,'8':7,'9':6,'0':6}
s=input()
count=0
for i in range(len(s)):
	count+=l[s[i]]
print(count)


c=0
a=input()
for i in a:
	if i=='1':
	    c=c+2
	elif i=='2':
	    c=c+5
	elif i=='3':
	    c=c+5
	elif i=='4':
	    c=c+4
	elif i=='5':
	    c=c+5
	elif i=='6':
	    c=c+6
	elif i=='7':
	    c=c+3
	elif i=='8':
	    c=c+7
	elif i=='9':
	    c=c+6
	elif i=='0':
	    c=c+6
print(c)    		


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
n = input()
count = 0
for digit in n:
	if digit == '1':
		count += 2
	elif digit == '2' or digit=='3' or digit=='5':
		count += 5
	elif digit == '4':
		count += 4
	elif digit == '6' or digit == '9':
		count += 6
	elif digit == '7':
		count += 3
	elif digit == '8':
		count += 7
	elif digit == '0':
		count += 6
print(count)        
		


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
s = input()
s = list(s)
c=0
for i in range(len(s)):
	if s[i]=='0':
		c+=6
	if s[i]=='1':
		c+=2
	if s[i]=='2':
		c+=5
	if s[i]=='3':
		c+=5
	if s[i]=='4':
		c+=4
	if s[i]=='5':
		c+=5
	if s[i]=='6':
		c+=6
	if s[i]=='7':
		c+=3
	if s[i]=='8':
		c+=7
	if s[i]=='9':
		c+=6
print(c)


n=input()


if '0' in n:
	c0=6

else:
	c0=0

if '1' in n:
	c1=2

else:
	c1=0

if '2' in n:
	c2=5

else:
	c2=0
	

if '3' in n:
	c3=5

else:
	c3=0

if '4' in n:
	c4=4

else:
	c4=0
	
if '5' in n:
	c5=5

else:
	c5=0

if '6' in n:
	c6=6

else:
	c6=0

if '7' in n:
	c7=3

else:
	c7=0
	
if '8' in n:
	c8=7

else:
	c8=0

if '9' in n:
	c9=6

else:
	c9=0



print(((c1*n.count('1'))+(c2*n.count('2'))+(c3*n.count('3'))+(c4*n.count('4'))+(c5*n.count('5'))+(c6*n.count('6'))+(c7*n.count('7'))+(c8*n.count('8'))+(c9*n.count('9'))+(c0*n.count('0'))))




import sys
s=input()
sum1=0
d={'0':6, '1':2, '2':5, '3':5,'4':4, '5':5, '6':6, '7':3, '8':7, '9':6}
for i in s:
	if i in d:
		sum1=sum1+d[i]
		
print(sum1)
		
		


#
# @author:SRvSaha
# what_is_string_made_of.py
# Description :
#
sum = 0
string = input()
list_from_string = list(string)
list_from_string = [int(item) for item in list_from_string]
dictionary = {0:6,1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
for element in list_from_string:
	if element in dictionary:
		sum += dictionary[element]
print(sum)