SRM 148 DIV2 250

与えられた数字の各桁の数字の中で与えられたその数字自体を割り切れるものをカウントして返す

#include <string>
#include <vector>
#include <sstream>
using namespace std;

class DivisorDigits {
    public:
    int howMany(int number) {
        int count = 0;
        string s;
        stringstream ss;

        ss << number;
        s = ss.str();

        for (int i = 0; i < s.length(); i++) {
            if (s[i] == '0') {
                continue;
            }
            int n = s[i] - '0';
            if (number % n == 0) {
                count++;
            }
        }	
        return count;
    }
};