gets s=gets t=gets p ['A','B'].map{|c|[s.count(c),t.count(c)].min}.sum