Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // example data in .txt file: ABCCAAACACCCCBCBCAACCCCCA
- program p;
- uses crt;
- var filetxt : text;
- Count_C_in_current_chain : integer;
- i : integer;
- S : String;
- max_len_C : integer;
- ch : char;
- begin
- assign(filetxt, 'test.txt');
- reset(filetxt);
- max_len_C := 0;
- Count_C_in_current_chain := 0;
- while not eof(filetxt) do
- begin
- read(filetxt, Ch);
- if( ch = 'C') then
- Count_C_in_current_chain := Count_C_in_current_chain + 1
- else
- begin
- if (Count_C_in_current_chain > max_len_C ) then
- begin
- max_len_C := Count_C_in_current_chain;
- end;
- Count_C_in_current_chain := 0;
- end;
- end;
- write(' Max-length C-chain: ', max_len_C);
- close(filetxt);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement