#include <iostream>
#include <vector>

using namespace std;

vector<int> adj[27];
bool used[27];
int current_size = 0;

void dfs(int node) {
    used[node] = true;
    current_size++;
    for (int neighbor : adj[node]) {
        if (!used[neighbor]) {
            dfs(neighbor);
        }
    }
}

int main() {
    // Example: assuming a and b are strings of the same length
    string a = "hello";
    string b = "world";
    int n = a.length();
    
    // Build the graph
    for (int i = 0; i < n; i++) {
        if (a[i] != b[i]) {
            int u = a[i] - 'a' + 1;
            int v = b[i] - 'a' + 1;
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
    }

    int ans = 0;
    
    // Traverse the components
    for (int i = 1; i <= 26; i++) {
        // We only care about unvisited nodes that are actually part of an edge
        if (!used[i] && !adj[i].empty()) { 
            current_size = 0;
            dfs(i);
            ans += (current_size - 1);
        }
    }
    
    cout << ans << endl;
    return 0;
}