program hash_example
    implicit none
    character(len=20) :: student_id, name
    character(len=40) :: combined_string
    integer :: i, hash_value

    ! 1. 入力
    print *, "学籍番号を入力してください:"
    read(*, '(A)') student_id
    print *, "氏名を入力してください:"
    read(*, '(A)') name

    ! 2. 連結 (trimで余分な空白を除去)
    combined_string = trim(student_id) // trim(name)
    print *, "連結された文字列: ", trim(combined_string)

    ! 3. 簡易ハッシュ計算 (各文字のASCIIコードの合計を求める例)
    hash_value = 0
    do i = 1, len_trim(combined_string)
        hash_value = hash_value + ichar(combined_string(i:i))
    end do

    ! 4. 結果表示
    print *, "計算された簡易ハッシュ値: ", hash_value

end program hash_example