If the speed of the train is s, and it passes by a observer (a single point) in 6 seconds, then the length of the train is 6s.
The time it takes to pass the bridge begins when the front of the train first gets on the bridge, to the moment when the back end of the train leaves the other end of the bridge (at which point the front is 6s meters past the end of the bridge). Therefore the total length travelled is (6s + 350) meters, which takes 20 seconds. This means the speed is (6s + 350) / 20 = 0.3s + 17.5, and this should be equivalent to our original expression for speed: s.
0.3s + 17.5 = s0.7s = 17.5s = 25 m/s
length of train = 6s = 150 m