import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s1 = sc.next(); String s2 = sc.next(); int[] holiday = new int[14]; if(s1.charAt(0) == 'o') holiday[0] = 1; for(int i = 1; i < 7; i++) { if(s1.charAt(i) == 'o') holiday[i] = holiday[i - 1] + 1; } for(int i = 0; i < 7; i++) { if(s2.charAt(i) == 'o') holiday[i + 7] = holiday[i + 6] + 1; } int ans = 0; for(int i = 0; i < 14; i++) { ans = Math.max(ans, holiday[i]); } System.out.println(ans); } }