演習問題5

1) デ−タファイル(ファイル名sumo.d)がある。このファイルの内容を次に示す。

----+----1----+----2----+----3----+----4----+----5----+----6----+----7
   Yesterday when I got on the train in Shibuya, I had a big          
 surprise, and I mean big! There were three sumo wrestlers on the     
 train. I was standing by the door right next to one of them, but I   
didn't recognize him. The other two were sitting behind me. I really  
    :
    :
aprons, I think, "Wow! I'm really in Japan," and I feel happy to      
be here. And that was just how I felt on the train yesterday too.     
                                                                      
File end            NHK ラジオ英会話テキストより                      
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
前後の目盛りの行は除く。

このファイルを読んで、文字 A または a 、文字列 The または the がファイル中に何個含まれているか数えよ。ファイルの終わりは行の先頭の文字列'File end'で判断し、その行は対象としない。

ヒント
文字変数 m ( character m*70 )に一行分のデータを読み込む。
m(1:1),m(2:2), ... ,m(70:70) について、A または a に等しいか調べて数える。
また、m(1:3),m(2:4), ... ,m(68:70) について、The または the に等しいか調べて数える。
これをデータの終わりまで繰り返す。
Fortranの文法文字処理を参照。