#include int main() { int n, m, k, v[1000], st, i, j, b; char a[99][99]; FILE *f; f = fopen("in.txt", "r"); scanf("%d %d\n", &n, &m); //fscanf(f, "%d %d\n", &n, &m); for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { scanf("%c", &a[i][j]); } scanf("\n"); } i = 0; j = 0; st = 0; while (i < n) { while (a[i][j+1] != '&') { j++; st++; } a: if (a[i+1] != '&') { i++; st++; } else { j--; goto a; } } for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { printf("%c ", a[i][j]); } printf("\n"); } printf("%d", st); return 0; }