use strict; use warnings; use v5.16; # https://yukicoder.me/problems/783 # my $input = "1a2b3c4d5e6f7g8h90"; my $input = <>; chomp $input; my @a = split //, $input; my $sum = 0; for my $n (@a){ if ($n =~ /\d/){ $sum += $n; }; } say $sum;