s=gets;puts ["*^", "^*"].map{|c| s.scan(c).length}*' '